CGRect frame = CGRectMake(300, 300, 300, 50);
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = frame;
[button setTitle:@"新添加的动态按钮" forState: UIControlStateNormal];
button.backgroundColor = [UIColor clearColor];
button.tag = 2000;
[button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
-(IBAction) buttonClicked:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示"
message:@"单击了动态按钮!"
delegate:self
cancelButtonTitle:@"确定"
otherButtonTitles:nil];
[alert show];
[alert release];
}
kilmas
- 发布:2015-08-08 17:40
- 更新:2015-08-10 15:19
- 阅读:1596
2 个回复
kilmas (作者) - 还是红领巾啊
我在安卓上是这样实现的 :求ios交流
DCloud_IOS_XTY
该功能 iOS建议插件实现