2012-03-21 50 views
-2

當我編寫一個簡單的代碼來創建表格時,我得到了_CGRect referenced From錯誤。我不知道如何解決這個錯誤。我甚至增加了CoreGraphics框架到我的項目在Xcode中爲iPhone創建表格

static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier]; 
if (cell == nil) 
{ 
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier: SimpleTableIdentifier] autorelease]; 
} 

NSUInteger row = [indexPath row]; 
cell.text = [listData objectAtIndex:row]; 
return cell; 

回答

0

嘗試

CGRectMake(0,0,widthOfCell,heightOfCell) 

cell initWithFrame 

方法,我覺得應該謂爲你做到這一點。

+0

謝謝你,但我沒有像 – 2012-03-21 08:41:28

+1

那樣的任何方法,當然你可以。檢查你自己的代碼。 cell = uitableviecell initwithframe – 2012-03-21 08:43:05