WEB开发网
开发学院手机开发iPhone 开发 iPhone SDK 开发之 UIKit 使用 阅读

iPhone SDK 开发之 UIKit 使用

 2010-02-25 04:20:00 来源:WEB开发网   
核心提示:@interface ControllerDemoAppDelegate : NSObject {UIWindow *window;ControllerDemoViewController *viewController;}@property (nonatomic, retain) IBOutlet UIWindow

@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) {

上一页  1 2 3 4  下一页

Tags:iPhone SDK 开发

编辑录入:coldstar [复制链接] [打 印]
赞助商链接