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;
- ››开发学院教你用SQL 语句最快速清空MySQL 数据表的...
- ››iPhone应用帮助残障儿童看图说话
- ››iPhone实用工具AppBox Pro使用教程大揭秘
- ››iphone4省电方法
- ››iphone 获取地址的详细信息
- ››iPhone 库的基本内存管理策略
- ››iPhone加密文字亲手做 私密信息有保障
- ››iphone 根据经纬度坐标取详细地址(包括国,省,市...
- ››iphone/ipad ios cocoa object-c 近期苹果UI部分小...
- ››iphone中如何进行多线程编程
- ››iPhone OS SDK的这些事[安装、下载、版本、实例、...
- ››iPhone ObjectC的NSAutoreleasePool
赞助商链接