在自定义cell里面实现跳转的方法

来源:互联网 发布:mac 单独调节应用声音 编辑:程序博客网 时间:2024/06/10 06:50

我做的是 collectionView 里面铺了一个 tableView ,tableView写在了自定义的cell里;

在自定义里面无法实现跳转功能, 在ViewComtroller里面签一个代理,<UITableViewDelegate>

在引一下需要跳转页面的头文件;

CollectionViewCell 的代理中签代理人 cell.tableView.delegate = self;

在实现跳转方法;

// 点击方法,跳转

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    

    TwoViewController *two = [[TwoViewController alloc] init];

    [self.navigationController pushViewController:two animated:YES];
    
}
0 0
原创粉丝点击