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) {
- ››开发Android 日历教程
- ››开发学院总结 Win 8实用技巧大全
- ››开发学院原创教程:把win8的IE10放桌面上方法(非...
- ››iphone图片拉伸的几种方法
- ››iphone正则表达式的简单使用
- ››iPhone开发Unresolved Symbols CAKeyframeAnimati...
- ››IPhone开发-“此证书是由未知颁发机构签名”解决方...
- ››IPhone开发-整合私钥和证书,生成.p12文件
- ››iPhone应用开发-UIPickerView选取器详解
- ››iphone 获取屏幕的宽度和高度
- ››iPhone读取工程包中的二进制文件
- ››iPhone新手机 不挂YouTube APP
更多精彩
赞助商链接