Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daohoangson/ios-swift-uisplitviewcontroller-ios8
UISplitViewController that works with both iOS 7 and iOS 8
https://github.com/daohoangson/ios-swift-uisplitviewcontroller-ios8
Last synced: 25 days ago
JSON representation
UISplitViewController that works with both iOS 7 and iOS 8
- Host: GitHub
- URL: https://github.com/daohoangson/ios-swift-uisplitviewcontroller-ios8
- Owner: daohoangson
- Created: 2014-11-28T19:48:12.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-28T20:24:36.000Z (almost 10 years ago)
- Last Synced: 2024-04-16T02:26:56.002Z (7 months ago)
- Language: Swift
- Size: 129 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# UISplitViewController that works with both iOS 7 and iOS 8
This demo project was created by XCode 6.1 with "Master-Detail Application" template. The built application will not work with iOS 7 because the template uses a new method which is only available since SDK 8 (`UISplitViewController::displayModeButtonItem`). With a quick check for the missing selector, `UISplitViewController` _magically_ works pretty well. Many blog posts addressed this issue but after a few hours of testing myself, their solution is still incomplete. Getting it to work in iPhone-iOS7 is easy because the controller transforms itself to a humble `UINavigationController`. The hardest thing IMHO is to get the popup bar item button to show up in portrait iPad. Turned out, it was pretty simple (and obvious once you know it): you just need to implement the deprecated `splitViewController:willHideViewController:withBarButtonItem:forPopoverController` and `splitViewController:willShowViewController:invalidatingBarButtonItem` in your `UISplitViewControllerDelegate`.
Download the project to see it in action. For screenshots, have a look at [my blog](http://geek.daohoangson.com/2014/11/the-new-uisplitviewcontroller-swift-and.html).
PS: In the template, it calls `UISplitViewController::displayModeButtonItem` twice. Once in `application:didFinishLaunchingWithOptions` and once in `MasterViewController::prepareForSegue` which is unnecessary so in the demo project, I moved the code to `DetailViewController::configureView`.