一个简单的iPhone项目及代码
2010-08-26 11:04:00 来源:WEB开发网[viewController release];
[window release];
[super dealloc];
}
@end
//
// HelloUserAppDelegate.m
// HelloUser
//
// Created by sin francis on 10-8-26.
// Copyright __MyCompanyName__ 2010. All rights reserved.
//
#import "HelloUserAppDelegate.h"
#import "HelloUserViewController.h"
#import "MyNewsViewController.h"
@implementation HelloUserAppDelegate
@synthesize window;
@synthesize viewController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after app launch
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}
- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}
@end
Controller的声明:
Cpp代码
//
// HelloUserViewController.h
// HelloUser
//
// Created by sin francis on 10-8-26.
// Copyright __MyCompanyName__ 2010. All rights reserved.
//
#import
@interface HelloUserViewController : UIViewController {
//链接到HelloUserViewController.xib 界面中的display label组件
IBOutlet UILabel *displayLable;
//链接到HelloUserViewController.xib 界面中的name Field组件
IBOutlet UITextField *nameField;
//链接到HelloUserViewController.xib 界面中的Button组件
IBOutlet UIButton *sayButton;
//注意:以上的只是引用,并未真实的链接到组件上去,那么就需要我们使用Interface Builder进行链接
//1. 使用Interface Builder打开HelloUserViewController.xib,打开HelloUserViewController.xib中View
更多精彩
赞助商链接