ios - Different layout for iPhone and iPad in the same Storyboard -
Xcode 6 supports "universal" storyboard. It is very convenient, it means that we only use one for iPhone and iPad The storyboard needs iPhone and iPad layout same.But here comes a question:
What is the same, most of the iPhone and iPad layouts are only a few or two differences in UIViewControllers ? How can we add different UIViewControllers to the same storyboard for iPhone and iPad
here's what I have done ?:
- (yellow part) storyboard
-
My code: (in iPad if you add to the navigation bar And add container and also the constraint of the obstacle for 0 Magistrate)
class ViewController: UIViewController {var segmentControl: UISegmentedControl! @IBotlett Weak St Sententner: UIUV! @IBOutlet Weak height height: NSLUT console! Override function viewDidLoad () {super.viewDidLoad () self.segmentControl = UISegmentedControl (item: ["personnal", "department", "company"]). UISegmentedControl as if UIDevice.currentDevice () userInterfaceIdiom == .pad {auto. NavigationItem.titleView = self.segmentControl self.heightConstrains.constant = 0} else {self.segContainer.addSubview (self.segmentControl)}}
My cases Very simple, implementation in code is not difficult, but what about a very complicated matter?
-
Comments
Post a Comment