iPhone SDK 开发之 UIKit 使用
2010-02-25 04:20:00 来源:WEB开发网2.2 使用interface builder
你可以用UIViewController类的initWithNibName方法加载interface builder创建的.xib资源文件.
MainViewController *myViewController = [
[ MainViewController alloc ]
initWithNibName: @"MainViewController"
bundle: nil
];
2.3 方向改变
(1)系统通过shouldAutorotateToInterfaceOrientation来检查是否可以旋转到interfaceOrientation所指示的方向.
-(BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation
{
return (YES);
}
UIDeviceOrientationUnknown //Catchall for errors or hardware failures
UIDeviceOrientationPortrait //Oriented upright vertically in portrait mode
UIDeviceOrientationPortraitUpsideDown //Oriented upside-down vertically in portrait mode
UIDeviceOrientationLandscapeLeft //Device is rotated counter-clockwise in landscape mode
UIDeviceOrientationLandscapeRight //Device is rotated clockwise in landscape mode
UIDeviceOrientationFaceUp //Device is laying flat, face up, such as on a table
UIDeviceOrientationFaceDown //Device is laying flat, face down, such as on a table
(2)当方向改变时,系统会调用didRotateFromInterfaceOrientation
- (void)didRotateFromInterfaceOrientation:
(UIInterfaceOrientation)fromInterfaceOrientation
{
}
2.4 清除view controller
- (void)dealloc {
[ textView release ];
[ super dealloc ];
}
2.5 Controller demo
Example 3-7. ControllerDemo application delegate prototypes (ControllerDemoAppDelegate.h)
#import
@class ControllerDemoViewController;
- ››开发Android 日历教程
- ››开发学院总结 Win 8实用技巧大全
- ››开发学院原创教程:把win8的IE10放桌面上方法(非...
- ››iphone图片拉伸的几种方法
- ››iphone正则表达式的简单使用
- ››iPhone开发Unresolved Symbols CAKeyframeAnimati...
- ››IPhone开发-“此证书是由未知颁发机构签名”解决方...
- ››IPhone开发-整合私钥和证书,生成.p12文件
- ››iPhone应用开发-UIPickerView选取器详解
- ››iphone 获取屏幕的宽度和高度
- ››iPhone读取工程包中的二进制文件
- ››iPhone新手机 不挂YouTube APP
更多精彩
赞助商链接