2017-03-02 65 views
0

我試圖實現以下目標:的UITableViewCell顯示,當設備的額外標籤,景觀

  • 在一個UITableViewCell我有3個標籤的StackView,但我想在肖像其中只有兩個節目,以及所有當他們在風景模式。

什麼我試圖做的是:添加自定義的安裝屬性,只有當設備處於CXC檢查......但是當我運行的應用程序,並旋轉模擬器我得到這個上調試:未決:位置從NSPoint:{36.5,15}到可選(NSPoint:{40.5,15})

我附加的圖像顯示我想要實現的。

非常感謝![tableview] 1

回答

0

你可以找到通過獲取設備向狀態定向和隱藏第三標籤

if UIDevice.currentDevice().orientation == UIDeviceOrientation.LandscapeLeft{ 
    cell.thirdLabel.hidden = false 
    } 
    else if UIDevice.currentDevice().orientation == UIDeviceOrientation.LandscapeRight{ 
    cell.thirdLabel.hidden = false 

    } 
    else if UIDevice.currentDevice().orientation == UIDeviceOrientation.UIDeviceOrientationPortraitUpsideDown{ 
    cell.thirdLabel.hidden = true 
    } 
    else if UIDevice.currentDevice().orientation == UIDeviceOrientation.UIDeviceOrientationPortrait{ 
    cell.thirdLabel.hidden = true 
    } 

您可以使用兩個刪除他人

+0

您好.. 。我嘗試過你的代碼,但仍然無法工作...仍在執行_ pending:位置從NSPoint:{36.5,15}到可選(NSPoint:{40.5,15})_旋轉設備時... – Cleversou

+0

If你正在使用任何庫更新它們最新版本,如果您正在使用動畫,請檢查它們是否在兩種模式下兼容更新。 –

+0

感謝您的回答...不使用動畫,所有庫更新(Realm) – Cleversou