我在视图中运行时创建了按钮,以网格的方式放置。现在我希望用户能够通过选择删除每一个。如何识别用户已选择从视图中正确删除它的用户?我在创建过程中使用 Tag 属性。
谢谢你。
我在视图中运行时创建了按钮,以网格的方式放置。现在我希望用户能够通过选择删除每一个。如何识别用户已选择从视图中正确删除它的用户?我在创建过程中使用 Tag 属性。
谢谢你。
这是一种方法。制作按钮时,将操作设置为视图或控制按钮推送逻辑的任何类:
UIButton *theButton = [UIButton buttonWithType:(UIButtonType)];
[theButton addTarget:self action:@selector(deleteMe:) forControlEvents:(UIControlEvents)];
然后,在类的某处实现 deleteMe: 方法:
-(void)deleteMe:(id)sender
{
//remove the button. sender is the button that was pushed.
}