我有一个带外部委托控制器的tableview.尽管内容表视图数组已经很好地填充,numberOfSectionsInTableView:
并且
-tableView: numberOfRowsInSection:
被调用,
但是-tableView: cellForRowAtIndexPath:
没有被调用.
发布的表视图以这种方式设置:
CompeticionViewController.h
....
@property (retain, nonatomic) IBOutlet UITableView *calendarioTable;
@property (strong, nonatomic) calendarioViewController *calendarioController;
....
calendarioTable = [[UITableView alloc] init];
calendarioController = [[calendarioViewController alloc] init];
[calendarioTable setDelegate:calendarioController];
[calendarioTable setDataSource:calendarioController];
calendarioController.calendarioArray = [[NSMutableArray alloc] init];
[calendarioController.calendarioArray addObjectsFromArray: self.calendarioarray];
[calendarioTable reloadData];
Run Code Online (Sandbox Code Playgroud)
编辑:
calendarioViewController.m
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [calendarioArray count];
}
Run Code Online (Sandbox Code Playgroud)
非常感谢
你已经用了IBOulet
fortableview
那么你为什么要把allocating
它当作它的not need memory already allocated
。
现在签入xib
您的视图控制器tableview
并将binded
其delegate
提供datasource
给file owner
。
- - - - - - - - - - - - - - - - - - - - -或者- - - - ----------------------------------------------------
add
这条线在viewDidLoad method
yourtableview.delegate=self
yourtableview.datasource=self;
Run Code Online (Sandbox Code Playgroud)
现在使用IBOulet
for之后tableview
,您将把它与文件所有者和 ViewController绑定interface implements
在一起<UITableViewDelegate>
<UITableViewDataSource>
protocols
现在check array
你已经providing
在tableview
其中content
了
编辑:添加 OR 代码并完成格式化
归档时间: |
|
查看次数: |
2414 次 |
最近记录: |