2013-11-04 45 views
2

所以我在storyboard裏有UIScrollView,在storyboard裏也有UITableView。關鍵是我想在scrollview中放入UITableView的幾個實例。但是,我得到一個錯誤uiscrollview裏面的uitableview storyboard

unable to dequeue a cell with identifier Cell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard

那麼如何解決這個問題呢?

在此先感謝!

好的!這裏是我的代碼:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"DayCell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 

    [self configerCell:cell atIndexPath:indexPath]; 

    return cell; 
} 

我給了一個細胞在故事板的標識符...

這就是我添加的UITableView到的UIScrollView:

UITableViewController *tableView = [[UITableViewController alloc] initWithStyle:UITableViewStyleGrouped]; 
[self.mainScroll addSubview:tableView.view]; 
+0

您必須將-tableView:cellForRowAtIndexPath中的「Cell」替換爲您在故事板上給出了您的UITableViewCell原型的名稱。 – Akki

+0

請發佈相關代碼 - 可能是您的cellForRowAtIndexPath:方法 –

回答

0

我覺得你的tableview電池需要一個標識符。 Try'n點擊表格視圖單元格,並在屬性檢查器下有一個名爲Identifier的字段。檢查!