美文网首页
Swift实现在横版的iPad中左右两个控制器

Swift实现在横版的iPad中左右两个控制器

作者: CYC666 | 来源:发表于2023-04-06 19:03 被阅读0次

import UIKit

class ViewController: UISplitViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Create two view controllers
        let primaryVC = PrimaryViewController()
        let secondaryVC = SecondaryViewController()
        
        // Set the view controllers for the split view controller
        self.viewControllers = [primaryVC, secondaryVC]
        
        // Set the preferred display mode to show both view controllers
        self.preferredDisplayMode = .allVisible
    }
}


相关文章

网友评论

      本文标题:Swift实现在横版的iPad中左右两个控制器

      本文链接:https://www.haomeiwen.com/subject/rfvuddtx.html