iOS代码Button Demo

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];   

 

UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    btn.frame = CGRectMake(100, 200, 100, 50);
    btn.backgroundColor = [UIColor redColor];
    [btn addTarget:self action:@selector(onBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];

}

 

- (void)onBtnClick:(id)sender{

//你的功能代码

}

posted @ 2014-09-04 09:16  i0ject  阅读(148)  评论(0编辑  收藏  举报