iPad开发

1.UISplitViewController

 

2.判断是iPad

if   ( UI_USER_INTERFACE_IDIOM ()  ==  UIUserInterfaceIdiomPad )
{
        NSLog ( @ " iPad " ) ; 
}
else  
{
       NSLog ( @ " iPhone " ) ; 
}
iPad自带兼容模式可以运行iPhone程序。

3.模态视图
(1)使用presentModalViewController,并选择设置modalPresentationStyle属性:
    viewController.modalPresentationStyle=UIModalPresentationFormSheet; //样式风格
    viewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;//动画方向
    [self presentModalViewController:viewController animated:YES];// "self" here is a ViewController instance


其中UIModalPresentationStyle包含了多种样式弹出:
UIModalPresentationFullScreen,
UIModalPresentationPageSheet,
UIModalPresentationFormSheet,
UIModalPresentationCurrentContext

(2)使用UIPopoverController
    iPhone上没有popover功能

4.中文环境
   Localization native development region  改为 China
   选择xib,在右侧的Localization中添加Chinese(zh-Hans)

5.直接被添加到window中的view所在的viewController,可以得到旋转事件通知;
   独立的view被添加到window中,不会被旋转,可以通过 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationWillChange:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
- (void) orientationWillChange:(NSNotification *) notification {
    
    NSDictionary *userInfo = [notification userInfo];
    NSNumber *v = [userInfo objectForKey:UIApplicationStatusBarOrientationUserInfoKey];
    UIInterfaceOrientation o = [v intValue];
    
    CGFloat degrees = 0;
    if(o == UIInterfaceOrientationLandscapeLeft ) degrees = -90;
    else if(o == UIInterfaceOrientationLandscapeRight ) degrees = 90;
    else if(o == UIInterfaceOrientationPortraitUpsideDown) degrees = 180;
    
    [UIView beginAnimations:nil context:nil];
    alertView.transform = CGAffineTransformMakeRotation(degrees * M_PI / 180);
    alertView.frame = CGRectMake((int)alertView.frame.origin.x, (int)alertView.frame.origin.y, (int)alertView.frame.size.width, (int)alertView.frame.size.height);
    [UIView commitAnimations];
}
来处理它旋转一个角度;

6.自动旋转
在info.plist中添加 Supported interface orientations (iPad):Landscape (left home button) 这样就只支持左横屏启动,然后用代码控制,在ios5中可以实现系统启动及启动页面固定左横屏,其它页面可以自由横屏。
但在ios6中全部都不能转了。如果 Supported interface orientations (iPad)不写,或四个方向都写全了,才能自由横屏。

7.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值