在UIButton回调中执行Sese不起作用

时间:2017-02-06 05:18:43

标签: ios objective-c callback segue

UIButtontableviewCellxib加载了typedef void(^CallBack)(UIButton *sender); @property (copy, nonatomic) CallBack callBack; 。通过单击该按钮,它应该转到下一个视图...我已经写了回电话...

这是我在xib中的代码    TableViewCell.h

- (IBAction)buttonTapped:(id)sender {
    if (_callBack) {
    _callBack(sender);
}

TableViewCell.m

cell.callBack = ^(UIButton *sender) {
    [self performSegueWithIdentifier:@"segueIdentifier" sender:nil];
};

在viewcontroller中

/\b((100)|[1-9]\d?)\b/

performSegue线正在击中,但需要一些时间才能击中...为什么

2 个答案:

答案 0 :(得分:0)

试试这个:

select c.level as level, p.level as parent_level, c.id-p.id as distance_from_parent
from MyLevels AS p
JOIN MyLevels AS c on p.id = c.ParentLevelId

在View Controller中

@interface WACustomCell : UITableViewCell

@property(readwrite,copy)void (^cellCallBackMethod)(NSInteger rowIndexPath);

-(IBAction)buttonTappedFromCell:(id)sender;

@end

@implementation WACustomCell

@synthesize cellCallBackMethod;

-(IBAction)buttonTappedFromCell:(id)sender{

 self.cellCallBackMethod(0);

//any value can be given as we will retrieve this value from CellForRowAtIndex method

 }

答案 1 :(得分:0)

从自定义UIButton和UIView中将UserInteractionEnabled设置为NO解决了我的问题...感谢您的回复......