The document provides tips and information about using animations, modal views, and navigation controllers in Xcode projects. It discusses how animations work and how to set them up, how modal views are used to temporarily display content or get user input, and the differences between presenting view controllers modally versus using a navigation controller. It also outlines some common transition styles and when it would be appropriate to use navigation controllers or present view controllers modally.
3. ANIMATIONS
• когато изпълняваме анимация стойността, която
променяме получава новата си стойност незабавно
само визуализацията се забавя /в друг thread/
• при прекъсване на анмацията не се изпълнява
completion:^
• анимация може да прекъсва друга анимация и да
продължава от позицията до която е стигнала
Thursday, January 26, 12
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
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. UISCROLLVIEW
Навигация до определен обект
[scrollView scrollRectToVisible:temp
animated:NO];
Thursday, January 26, 12
8. MODAL VIEWS
Different view hierarchy
Thursday, January 26, 12
9. ЗА КАКВО СЕ ИЗПОЛЗВАТ?
• Незабавно събиране на информация от потребителя
• Временно показване на съдържание
• Промяна на работната среда
• Различни интерфейси за различните ориентации
• Нова иерархия от UIView
Thursday, January 26, 12
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 users
Thursday, January 26, 12 can tap to abandon the task.
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 it
Thursday, January 26, 12
16. TRANSITIONS
Vertical slide Flip PartialCurl
Thursday, January 26, 12
20. NAVIGATIONCONTROLLER
push push push
pop pop pop
[self.navigationController pushViewController:tableVC animated:YES];
[self.navigationController popViewControllerAnimated:YES];
Thursday, January 26, 12
21. РАЗЛИКАТА
push push push
pop pop pop
present
dismiss
Thursday, January 26, 12