2015-07-20 94 views
0

我的應用程序包含一個UITableViewController。默認縮進(編輯時)很好,除了在橫向模式下的iPad上,縮進太寬時。我已經嘗試在cellForRowAtIndexPath中設置indentationWidthindentationLevel,但似乎沒有任何效果。UITableViewCell自定義縮進寬度

,我想我的代碼工作是這樣的:

override func tableView(tableView: UITableView, 
    cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell 
{ 
    let cell = tableView.dequeueReusableCellWithIdentifier("Cell", 
                  forIndexPath: indexPath) 

    // do other cell configuration here 
    if UIDevice.currentDevice().userInterfaceIdiom == .Pad { 
     // set the custom indentation level for the cell here 
     // Tried: 
     // cell.indentationWidth = 0.1 
     // cell.indentationLevel = 0 
     // both have absolutely no effect 
    } 
} 

景觀iPad上可怕的縮進: editing 同樣的細胞,而不是編輯: not editing 在此先感謝您的幫助。

+0

有些圖片會對理解很有幫助。 – liushuaikobe

+0

@liushuaikobe感謝您的建議。爲了清晰起見,我添加了一些截圖。 –

+0

顯示您設置縮進級別的代碼。 – Mundi

回答

2

在viewDidLoad中,添加下列行:

self.tableView.cellLayoutMarginsFollowReadableWidth=NO; 

的默認設置爲是,並且導致在較新的ipad公司在景觀廣泛的利潤率。