2012-08-24 70 views
0

我添加一个tableviewCell在我的笔尖,即时通讯添加一个UIButton在一个单元格。问题是IBAction的按钮没有得到fired.im能够点击按钮可以你们帮助out.will如此感激按钮事件没有被解雇tableviewCell

+0

你右击你的fileOwner对象在笔尖链接IBAction为给UIButton的? – SayeedHussain

+0

yup它完成得很完美..像这样在tableView里面..i m添加tableview单元格放置按钮 – user578386

+0

你是通过nib添加UITableViewCell和UIButton吗? – SayeedHussain

回答

1

另一种方式来做到这一点...创建一个UIButton并将其添加到细胞在任何你需要它

- (UITableViewCell的*)的tableView:(UITableView的*) tableView cellForRowAtIndexPath :(NSIndexPath *)indexPath使用开关检查表格行

switch (indexPath.row) 

如果情况匹配,那么使用这个

UIButton *yourButton=[UIButton buttonWithType:UIButtonTypeRoundedRect]; 
[yourButton addTarget:self action:@selector(your_method_to_handle_button_clicked) forControlEvents:UIControlEventTouchUpInside]; 
yourButton.frame=CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>); 

[cell addSubview:yourButton]; 
+0

里面的表添加一个按钮的视图工作正常..其中一些复杂的地方在tableview.im里面添加一个tableview单元格放置butto的位置 – user578386

+0

你可以在button.frame = cgrectmake()中定义按钮位置..... – Neo