郝萌主傾心貢獻,尊重作者的勞動成果,請勿轉載。
如果文章對您有所幫助,歡迎給作者捐贈,支持郝萌主,捐贈數額隨意,重在心意^_^
我要捐贈: 點擊捐贈
Cocos2d-X源碼下載:點我傳送
1、是否設置代理與數據源
[table setDelegate:self];
[table setDataSource:self];
2、numberOfSectionsInTableView是否設置
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
3、numberOfRowsInSection方法返回值是否正確,如果不正確就不會執行 cellForRowAtIndexPath。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 1;
}
4、檢查Table是否被其他View遮擋
5、還有可能是autolayout引起的,autolayout約束不對,也會導致tableview顯示不出來,
cellForRowAtIndexPath是在顯示到界面的時候才調用,正確的設置autolayout就會執行該方法。
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-64-[table]-50-|" options:0 metrics:nil views:constraintsView ]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[table]-0-|" options:0 metrics:nil views:constraintsView ]];