WEB开发网
开发学院手机开发iPhone 开发 iPhone开发进阶 编程定制 UIViewController 阅读

iPhone开发进阶 编程定制 UIViewController

 2010-02-27 23:26:00 来源:WEB开发网   
核心提示:- (void)viewDidLoad {[super viewDidLoad];self.view.backgroundColor = [UIColor blueColor];}@end编译以后执行一下,看到下面的结果,iPhone开发进阶 编程定制 UIViewController(2),接下来我们再来添加按钮,我

- (void)viewDidLoad {

[super viewDidLoad];

self.view.backgroundColor = [UIColor blueColor];

}

@end

编译以后执行一下,看到下面的结果。

CustomViewController

接下来我们再来添加按钮,我们动态生成一个 UIButtonTypeInfoLight 类型的按钮,设置了按钮的 frame 后,用addSubview 添加到 view 上。

@implementation CustomViewController

- (void)viewDidLoad {

[super viewDidLoad];

self.view.backgroundColor = [UIColor blueColor];

UIButton* button = [UIButton buttonWithType:UIButtonTypeInfoLight];

button.frame = CGRectMake(100,100,100,100);

[self.view addSubview:button];

}

@end

最终的效果如下:

CustomViewController

下一讲我们来具体定制按钮动作。

上一页  1 2 

Tags:iPhone 开发 进阶

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