2010-07-21 32 views
0

我在視圖控制器中使用了表視圖,並且列表中顯示了簡單的數組。該數組顯示和工作正常,但我收到此警告。我想知道這樣做的原因,並請一些想法,以糾正這個問題..表視圖中的警告

警告:由於使用傳統的單元佈局委託執行 的tableView的:accessoryTypeForRowWithIndexPath:英寸請刪除此方法的實施,並將單元格屬性accessoryType和/或editingAccessoryType設置爲 以將其移動到新的單元格佈局行爲。在將來的版本中,此方法將不再稱爲 。

感謝

+2

直到你已經接受了一些回答您的問題以前我連慣於看你的問題:) – willcodejavaforfood 2010-07-21 08:00:15

+0

嗨willcodejavaforfood 請指導我如何接受答案。我不能讓你的意思是... – siva 2010-07-21 08:30:43

回答

0

它只是說,這種方法是關於在下一版本中消失,所以你應該去單證尋找的tableView:accessoryTypeForRowWithIndexPath,肯定你會發現這樣做的替代方式,你想你想要什麼去做。

換句話說,通過調用的UITableViewCell附件視圖和附件類型屬性

myCell.accessoryType = ... 
myCell.accessoryView = ... 
+0

嗨Nacho由於沒有足夠的空間,我已經在答案選項卡中回答pls,chk我的代碼.wher我犯了錯誤 謝謝爲您的建議! – siva 2010-07-21 10:26:42

3

方法tableView:accessoryTypeForRowWithIndexPath:在iPhone OS 3.0已被棄用設定該單元的附件。刪除此方法的實現,並在方法cellForRowAtIndexPath:添加以下代碼:

cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; 

UITableViewCellAccessoryType其它類型的文檔。如你所提到的使用下面的代碼

+0

您好Mathieuf由於沒有足夠的空間,我已經在答案選項卡中回答,chk我的代碼.wher我犯了錯誤 感謝您的意見! – siva 2010-07-21 10:26:38

+0

您是否刪除了方法tableView:accessoryTypeForRowWithIndexPath:? – MathieuF 2010-07-21 12:24:51

+0

雅我已經刪除了MathieuF現在它不顯示該警告,非常感謝:P – siva 2010-07-23 05:08:49

1

林:

// Customize the appearance of table view cells. 
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) { 
     cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; 
    } 
    // Set up the cell... 
    cell.text = [arry objectAtIndex:indexPath.row]; 
    cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton; 

    return cell; 
} 

但它返回相同的