實現的UITableView與自定義的UITableViewCell與下面碼UITableView的數據源必須返回從一個的tableView細胞:的cellForRowAtIndexPath /斷言失敗消息
@interface ProfileSaveViewController : UITableViewController
{
UITableViewCell *cell0;
UITableViewCell *cell1;
UITableViewCell *cell2;
UILabel *cell2Label;
}
@property (nonatomic, retain) IBOutlet UITableViewCell *cell0;
@property (nonatomic, retain) IBOutlet UITableViewCell *cell1;
@property (nonatomic, retain) IBOutlet UITableViewCell *cell2;
@property (nonatomic, retain) IBOutlet UILabel *cell2Label;
@end
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath*)indexPath
{
if([indexPath row] == 0) return cell0;
if([indexPath row] == 1) return cell1;
if([indexPath row] == 2) return cell2;
return nil;
}
follwing消息運行應用程序時就來了。
*在聲明失敗 - [UITableView的_createPreparedCellForGlobalRow:withIndexPath:],/SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:6072 2012-03-01 11:11:31.984 TestSplitView [765:F803] *終止應用程序由於未捕獲的異常「NSInternalInconsistencyException」,理由是:「UITableView的數據源必須的tableView返回細胞:的cellForRowAtIndexPath:」
- (NSInteger的)的tableView:(UITableView的*)的tableView numberOfRowsInSection:(NSInteger的)部分 { 返回3; } – Susitha 2012-03-01 06:17:31
那麼這是另一種可能性。你還沒有把所有的網點都連接到表格視圖單元格上。 – 2012-03-01 06:18:50
您的意思是「通過設置引用outlet atrribute」來「掛鉤」嗎? – Susitha 2012-03-01 06:19:14