Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
TIPS                           Извадки от xCode проектиThursday, January 26, 12
BLOCKS & ANIMATIONS    [UIView animateWithDuration:0.3 animations:^{                CGRect newFrame = self.frame;         ...
ANIMATIONS    • когато   изпълняваме анимация стойността, която        променяме получава новата си стойност незабавно    ...
ANIMATIONS           - (void)blink {               if (shown) return;                  [UIView animateWithDuration:0.3 ani...
USERINFO             [[NSNotificationCenter defaultCenter]             postNotificationName:kStatusBarPositionChange objec...
CUSTOM BUTTONS           Зареждане на картинки за различни състояния на                        UIButtonTypeCustom         ...
UISCROLLVIEW                              Навигация до определен обект                              [scrollView scrollRect...
MODAL VIEWS                            Different view hierarchyThursday, January 26, 12
ЗА КАКВО СЕ ИЗПОЛЗВАТ?    • Незабавно                 събиране на информация от потребителя    • Временно                 ...
current task or workflow.                           To learn more about defining a modal view in your code, see UIViewCont...
MODALVIEW УПОТРЕБА                            TransitionThursday, January 26, 12
ЗА КАКВО СЕ ИЗПОЛЗВА?                           Drawing canvas                                            писане на       ...
UIModalPresentati                                                                                       Presenting View Co...
IDESK - SEND EMAILThursday, January 26, 12
Presenting View Controllers From Other View Controllers                   About View Controller Presentation              ...
TRANSITIONS                       Vertical slide   Flip   PartialCurlThursday, January 26, 12
NAVIGATION OR MODAL                           Как да изберем?Thursday, January 26, 12
NAVIGATION / MODAL VIEW                           Необходимо е потребителят да въведе текстThursday, January 26, 12
NAVIGATION / MODAL VIEWThursday, January 26, 12
NAVIGATIONCONTROLLER                                     push                 push                push                    ...
РАЗЛИКАТА                           push      push   push                           pop       pop    pop                  ...
MODALVIEWCONTROLLER                                            present                                            dismiss ...
ЗА СЛЕДВАЩИЯТ ПЪТ    • nsnotification        & targets    • blocks    • nstimer    • mapKitThursday, January 26, 12
Upcoming SlideShare
Loading in …5
×

iOS Tips + ModalVC

1,182 views

Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

iOS Tips + ModalVC

  1. 1. TIPS Извадки от xCode проектиThursday, January 26, 12
  2. 2. BLOCKS & ANIMATIONS [UIView animateWithDuration:0.3 animations:^{ CGRect newFrame = self.frame; newFrame.origin.y = 0; self.frame = newFrame; self.alpha = 1; shown = YES; } completion:^ (BOOL finished) { if (finished) { //shown = YES; } }];Thursday, January 26, 12
  3. 3. ANIMATIONS • когато изпълняваме анимация стойността, която променяме получава новата си стойност незабавно само визуализацията се забавя /в друг thread/ • при прекъсване на анмацията не се изпълнява completion:^ • анимация може да прекъсва друга анимация и да продължава от позицията до която е стигналаThursday, January 26, 12
  4. 4. ANIMATIONS - (void)blink { if (shown) return; [UIView animateWithDuration:0.3 animations:^{ CGRect newFrame = self.frame; newFrame.origin.y = 0; self.frame = newFrame; self.alpha = 1; } completion:^ (BOOL finished) { if (finished) { //// Revert image view to original. sleep(3); shown = YES; [self hide:YES]; } }]; [[NSNotificationCenter defaultCenter] postNotificationName:kStatusBarPositionChange object:nil userInfo:[NSDictionary dictionaryWithObject:[NSValue valueWithCGRect:self.frame] forKey:@"frame"]]; } if ([userInfo objectForKey:@"frame"]) { Как да вземем frame от Value ! ! ! } statusBarFrame = [[userInfo objectForKey:@"frame"] CGRectValue];Thursday, January 26, 12
  5. 5. USERINFO [[NSNotificationCenter defaultCenter] postNotificationName:kStatusBarPositionChange object:nil userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSValue valueWithCGRect:self.frame], @"frame", [NSNumber numberWithFloat:animationDuration], @"duration", nil]];Thursday, January 26, 12
  6. 6. CUSTOM BUTTONS Зареждане на картинки за различни състояния на UIButtonTypeCustom imgName = [imgName stringByReplacingOccurrencesOfString:@".png" withString:@""]; ! [btn setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@.png", imgName]] forState:UIControlStateNormal]; [btn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@_high.png", imgName]] forState:UIControlStateHighlighted];Thursday, January 26, 12
  7. 7. UISCROLLVIEW Навигация до определен обект [scrollView scrollRectToVisible:temp animated:NO];Thursday, January 26, 12
  8. 8. MODAL VIEWS Different view hierarchyThursday, January 26, 12
  9. 9. ЗА КАКВО СЕ ИЗПОЛЗВАТ? • Незабавно събиране на информация от потребителя • Временно показване на съдържание • Промяна на работната среда • Различни интерфейси за различните ориентации • Нова иерархия от UIViewThursday, January 26, 12
  10. 10. current task or workflow. To learn more about defining a modal view in your code, see UIViewController Class Reference . MODAL VIEW Appearance and Behavior A modal view occupies the entire application screen, which strengthens the user’s perception of entering a Необходим е отговор преди потребителят да може да separate, transient mode in which they can accomplish something. On iPad, a modal view might also occupy the entire area of a parent view, such as a popover. продължи the controls necessary to perform the task. A modal A modal view can display text if appropriate, and contains view generally displays a button that completes the task and dismisses the view, and a Cancel button usersThursday, January 26, 12 can tap to abandon the task.
  11. 11. MODALVIEW УПОТРЕБА TransitionThursday, January 26, 12
  12. 12. ЗА КАКВО СЕ ИЗПОЛЗВА? Drawing canvas писане на писмо Drawing canvas временно представяне Organizer HelpThursday, January 26, 12
  13. 13. UIModalPresentati Presenting View Controllers From Other View Controllers Configuring the Presentation Style for Modal Views IPAD PRESENTATION STYLES Figure 9-4 iPad presentation styles UIModalPresentationFullScreen UIModalPresentati Presenting View Controllers From Other View Controllers Configuring the Presentation Style for Modal Views Figure 9-4 iPad presentation styles UIModalPresentationFullScreen UIModalPresentationPageSheet UIModalPresentati For guidance on when to use the different presentation styles, see “Po Guidelines . UIModalPresentationFullScreenUIModalPresentationPageSheet UIModalPresentationPageSheet UIModalPresentationFormSheet UIModalPresentationFormSheet 2012-‐01-‐09 | © 2012 Apple Inc. All Rights Rese 85 For guidance on when to use the different presentation styles, see “Popover (iPad Only)” in iOS Human Interface Guidelines . UIModalPresentationFormSheet 2012-‐01-‐09 | © 2012 Apple Inc. All Rights Reserved.Thursday, January 26, 12
  14. 14. IDESK - SEND EMAILThursday, January 26, 12
  15. 15. Presenting View Controllers From Other View Controllers About View Controller Presentation PRESENT MODAL and then presents another view controller (the people picker) in response to that action. Selecting a contact (or canceling the people picker) dismisses that interface and takes the user back to the photo library. Tapping the Done button then dismisses the photo library and takes the user back to the camera interface. Figure 9-2 Creating a chain of modal view controllers Camera Photo library Action sheet People picker view controller navigation controller navigation controller present present modally modally Each view controller in a chain of presented view controllers has pointers to the other objects surrounding itThursday, January 26, 12
  16. 16. TRANSITIONS Vertical slide Flip PartialCurlThursday, January 26, 12
  17. 17. NAVIGATION OR MODAL Как да изберем?Thursday, January 26, 12
  18. 18. NAVIGATION / MODAL VIEW Необходимо е потребителят да въведе текстThursday, January 26, 12
  19. 19. NAVIGATION / MODAL VIEWThursday, January 26, 12
  20. 20. NAVIGATIONCONTROLLER push push push pop pop pop [self.navigationController pushViewController:tableVC animated:YES]; [self.navigationController popViewControllerAnimated:YES];Thursday, January 26, 12
  21. 21. РАЗЛИКАТА push push push pop pop pop present dismissThursday, January 26, 12
  22. 22. MODALVIEWCONTROLLER present dismiss [self presentModalViewController:tableVC animated:YES]; [self dismissModalViewControllerAnimated:YES];Thursday, January 26, 12
  23. 23. ЗА СЛЕДВАЩИЯТ ПЪТ • nsnotification & targets • blocks • nstimer • mapKitThursday, January 26, 12

×