iPhone SDK 开发之 UIKit 使用
2010-02-25 04:20:00 来源:WEB开发网@interface ControllerDemoAppDelegate : NSObject
UIWindow *window;
ControllerDemoViewController *viewController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet ControllerDemoViewController *viewController;
@end
Example 3-8. ControllerDemo application delegate (ControllerDemoAppDelegate.m)
#import "ControllerDemoAppDelegate.h"
#import "ControllerDemoViewController.h"
@implementation ControllerDemoAppDelegate
@synthesize window;
@synthesize viewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
CGRect screenBounds = [ [ UIScreen mainScreen ] bounds ];
self.window = [ [ [ UIWindow alloc ] initWithFrame: screenBounds ]
autorelease
];
viewController = [ [ ControllerDemoViewController alloc ] init ];
[ window addSubview:viewController.view ];
[ window makeKeyAndVisible ];
}
- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}
@end
Example 3-9. ControllerDemo view controller prototype (ControllerDemoViewController.h)
#import
#import
@interface ControllerDemoViewController : UIViewController {
NSString *helloWorld, *woahDizzy;
UITextView *textView;
}
@end
Example 3-10. ControllerDemo view controller (ControllerDemoViewController.m)
#import "ControllerDemoViewController.h"
@implementation ControllerDemoViewController
- (id)init {
self = [ super init ];
if (self != nil) {
- ››开发学院教你用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
更多精彩
赞助商链接