2010-07-29 71 views
0

上自定義單元格設置editingStyle下面的代碼(位於我-viewWillAppear)成功地實現了作爲tableFooterView細胞:在tableFooterView

CGRect cellRect = [self.tableView rectForRowAtIndexPath:0]; 
    UITableViewCell *footerCell = [[UITableViewCell alloc] initWithFrame:cellRect]; 
    //footerCell.editingStyle = UITableViewCellEditingStyleInsert; 
    footerCell.textLabel.text = @"Add New Class"; 
    self.tableView.tableFooterView = footerCell; 

然而,被註釋掉返回該錯誤的行:對象不能設置 - 只讀屬性或找不到setter

如何設置此單元格的editingStyle插入?

回答

1

通常情況下,UITableViewCell實例只能進入UITableView「行」而不進入頁腳本身。然而,因爲它是UIView的子類,我想它會起作用。

您遇到的問題是它是隻讀屬性。您試圖設置的信息通常由代表通過UITableView發現。因此,您正在試圖將一個方形掛釘放入一個圓孔中。

我會創建一個自定義UIView放入您的頁腳,而不是試圖將UITableViewCell放在那裏。

+0

這很有道理。織釘:P – Spindler 2010-07-30 19:24:11

相關問題