点击自定义cell某块区域实现界面跳转跳转

今天做项目遇到一个这样的需求,记录下来,怕以后忘记!

需求是:点击左边这个自定义cell的区域跳转到活动详情页

看图:

点击自定义cell某块区域实现界面跳转跳转_第1张图片


那么如果按照以前的点击某行的cell- (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath{}

则不能实现需求提的功能,因为点击的是整行。

接下来说一下我的实现思路:做一个和点击cell等大的button,在上点击事件就好


//左边的btn


//左边的btn

@property(nonatomic,strong)UIButton*left_Btn;



- (void)viewDidLoad 创建button并添加点击事件

_left_Btn= [[UIButtonalloc]initWithFrame:CGRectMake(0,30,KAppWidth-55,85)];

[_left_BtnaddTarget:self action:@selector(didJusp:)forControlEvents:UIControlEventTouchUpInside];


-(void)didJusp:(UIButton*)btn{

NSLog(@"------");

UIStoryboard*storyboard = [UIStoryboardstoryboardWithName:@"MainViewController"bundle:nil];

EventDetailsController*eventDetailsVC = [storyboardinstantiateViewControllerWithIdentifier:@"EventDetailsController"];

[self.navigationControllerpushViewController:eventDetailsVCanimated:YES];

}

你可能感兴趣的:(点击自定义cell某块区域实现界面跳转跳转)