以编程方式向表格视图单元格添加button。

嘿家伙,我可以添加和删除单元格到我的表格视图。 我想要添加每个单元格的两个button。 有人可以帮我吗? 我find了这个,我找不到任何地方! 我会喜欢一些帮助! 非常感谢! :d

添加button作为您的单元格的子视图.Tats它。我已经给出了示例

//Create ur cell then do the following UIButton *newBtn=[UIButton buttonWithType:UIButtonTypeCustom]; [newBtn setFrame:CGRectMake(10,5,55,55)]; [newBtn addTarget:self action:@selector(urSelctor:) forControlEvents:UIControlEventTouchUpInside]; [cell addSubview:newBtn];