31. Preview
/**
sing a song
@code
ViewController controller = [ViewController alloc] init];
[controller singSong:@" 89 "];
@endcode
@see http://www.apple.com for more info
@param song
the song to sing
@return YES if song name lenght > 3
*/
-(BOOL)singSong:(NSString*)song
{
if (song.length > 3)
{
return YES;
}
else
{
return NO;
}
}
55. - (void)viewDidLoad
{
[super viewDidLoad];
! // Do any additional setup after loading the view, typically from a nib.
self.extendedLayoutIncludesOpaqueBars =YES;
self.edgesForExtendedLayout = UIRectEdgeTop | UIRectEdgeBottom;
}
scroll view inset
scroll view, table view, web view
57. full screen
• iOS 6 : (0, 0)
• iOS 7:
• only status bar : (0, 20)
• status bar + nav bar: (0, 64)
topLayoutGuide &
bottomLayoutGuide
topLayoutGuide
nav bar
60. :
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleDefault;
}
( )
method controller status bar
controller default
status bar
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:
(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
return YES;
}
status bar controller
View controller-based status bar appearance
(UIViewControllerBasedStatusBarAppearance)
NO setStatusBarStyle:
61. hide status bar
view controller
[[UIApplication sharedApplication]
setStatusBarHidden:isHide
withAnimation:UIStatusBarAnimationFade];
!
hide status bar
- (BOOL)prefersStatusBarHidden
{
return YES;
}
controller status bar
88. Replay
- (IBAction)replayAction:(id)sender
{
// Moving an item does not reset its velocity. Here we do that manually
// using the dynamic item behaviors, adding the inverse velocity for each
// square.
[self.square1PropertiesBehavior addLinearVelocity:CGPointMake(0, -1 *
[self.square1PropertiesBehavior linearVelocityForItem:self.square1].y)
forItem:self.square1];
self.square1.center = CGPointMake(90, 171);
[self.animator updateItemUsingCurrentState:self.square1];
[self.square2PropertiesBehavior addLinearVelocity:CGPointMake(0, -1 *
[self.square2PropertiesBehavior linearVelocityForItem:self.square2].y)
forItem:self.square2];
self.square2.center = CGPointMake(230, 171);
[self.animator updateItemUsingCurrentState:self.square2];
}