我有一個問題,而裝上的UITabBarController一個UITableView,我同時使用裝表標籤在基於標籤的iPhone應用程序中加載UITableView?
終止應用程序由於未捕獲的異常「NSInternalInconsistencyException」,理由得到這個錯誤:「UITableView的數據源必須返回從的tableView細胞:的cellForRowAtIndexPath: 「
我的代碼是在這裏
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
// Configure the cell...
return cell;
}
我嘗試了很多,這可能是簡單的..任何人都幫我嗎?
當你不需要創建一個新的'cell'時,你忘記檢查'if(cell == nil)'的條件,那麼它將被重用。 – Hemang 2012-04-03 11:17:29
感謝您的重播,是的,我忘記檢查條件。謝謝,現在它工作正常。 – 2012-04-03 11:44:27
@NeerajNeeru,gr8 happie編碼!:) – Hemang 2012-06-19 07:26:00