2017-05-17 3 views
1

Portraitのアイテムのリストを表示するには、UICollectionViewで作業中です。UICollectionViewControllerを使用して実装しました。UICollectionView - ランドスケープモードのデザインを変更

enter image description here

今、私は以下のスクリーンショットに示すようにLandscapeモードで同じことを設計し直したいです。

enter image description here

どのように私は、肖像画の再使用して、同じコードベースでLandscapeモードでUICollectionViewUICollectionViewFlowLayoutを使用して、このような設計を得ることができますか?出来ますか?アドバイスをお願いしますか?

ありがとうございます。

+0

をご確認ください。詳細画面のみを表示できます。風景、左(cell1&header)と右(cell2 cell3 cell4)の両方で –

+1

がスクロール可能ですか? –

+0

@elk_cloner、ご返信ありがとうございます。両方ではありません。ランドスケープでのみ、cell2 cell3 cell4はスクロール可能です。 –

答えて

1

また、stackviewを使用することもできます。 2つのビューを持つスタックビューを作成し、方向が変わると軸を変更します。要件に適切な制約を設定します。

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { 
    handleOrientationForLandscape(isLandscape: UIDevice.current.orientation.isLandscape) 
    } 
    func handleOrientationForLandscape(isLandscape: Bool) { 

    if isLandscape 
    { 
     containerStackview.axis = .horizontal 
     topViewWidthConstraint.constant = 700 

    }else 
    { 
     containerStackview.axis = .vertical 
     topViewWidthConstraint.constant = UIScreen.main.bounds.width 
    } 

    } 

私は肖像画で、uはマスターとディテールの両方を表示することができます風景モードでは、UISplitViewController`は、ディスプレイのこの種のためのより良いです `使って考えるhttps://github.com/karthikprabhuA/stackOverflowAnswer

enter image description here

enter image description here

関連する問題