我遇到问题。我有一个ViewController1包含tableView.that的tableView创建自定义tableViewCell将自定义表格中的uicollectionview数据传递给视图控制器
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
TableCategoryCell *cell = (TableCategoryCell *)[tableView dequeueReusableCellWithIdentifier:CategoryCellIndentifier];
}
在TableCategoryCell.m包含的CollectionView自定义单元格。
-(UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UICollectionViewCell *cell_collection = [collectionView dequeueReusableCellWithReuseIdentifier:COLLECTION_CELL_IDENTIFIER forIndexPath:indexPath];
}
现在我想用户点击的CollectionView项didSelectItemAtIndexPath
方法打开新ViewController2和数据传递到视图控制器2?
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UINavigationController *navigationController =[storyboard instantiateViewControllerWithIdentifier:@"Navigation"];
ViewController2 *watchController = [storyboard instantiateViewControllerWithIdentifier:WATCH_IDENTIFIER];
[navigationController pushViewController:watchController animated:YES];
}
我可以在故事板从集合项目推ViewController2但我不知道在编程? 我该怎么办?
所以,如果你在集合视图中选中该单元格,应该推到第二个视图控制器。你是这个意思吗? –
是的..我不知道如何推到2nd ViewController –