object c 源代码动态增加按钮,并给按钮一个点击事件
- (void)viewDidLoad {
    [super viewDidLoad];
    CGRect frame = CGRectMake(90, 200, 200, 60);
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn.frame = frame;
    btn.backgroundColor  = [UIColor clearColor];
    [btn setTitle:@"动态添加一个按钮!" forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(Edit:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];
    // Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
//一下代码为点击事件,注释的代码打开,可以出来一个消息弹窗
-(IBAction)Edit:(id)sender{
    //NSString *msg = @"f*au*ck U";
    //UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"message" message:msg                delegate:self cancelButtonTitle:@"No" otherButtonTitles:@"Yes", nil];  [alert show];
    
}