我有一个视图控制器,它是HomeController。我在HomeController中添加了一个tableview。我在这个UITableView
上添加了一个Custom Cell,其名称是HomeCategoryRow。所以我的搜索是我必须将HomeController实例传递给我的HomeCategoryRow
类来完成我的工作。提前谢谢。
答案 0 :(得分:0)
NSLog(@"The View Controller is: %@",_homeController);
UIStoryboard *storyboard = [UIStoryboard storyboardWithName: @"Main" bundle:[NSBundle mainBundle]];
AblumsController *myAlbum = [storyboard instantiateViewControllerWithIdentifier:@"AlbumsControllerIdentifier"]; // myAlbum.typeofParam=2;
myAlbum.homeController = _homeController;//ADD THIS
[_homeController pushViewController:myAlbum animated:YES];
<强> AblumsController.h 强>
@property (nonatomic, weak) id homeController;
或
@class HomeController;
@interface HomeTableViewController : UITableViewController
@property (nonatomic, weak) HomeController *homeController;
<强> AblumsController.m 强>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
HomeCategoryRow *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.homeController = self.homeController
}
<强> HomeCategoryRow.h 强>
@property (nonatomic, weak) id homeController;
或
@class HomeController;
@interface HomeCategoryRow : UITableViewCell
@property (nonatomic, weak) HomeController *homeController;
<强> HomeCategoryRow.m 强>
#import "HomeController.h"