I am building my first iPad application. And one of my requirements is to deal with UISplitviewcontroller and UINavigationController.
our proposed view hierarchy is
(LoginView) ->UINavigationView(LandingView + CollectionView)->UISplitViewcontroller( DetailsView).
Our app supports only landscape mode
I am referring this SO Question( and GILT app as well), as a newbi its hard for me to get it done based on that description.
So my questions are
1) How can I achieve same thing,if somebody can give small code snippets or reference to tutorial
2) As per Apples HIG, UISplitviewcontroller should be rootviewcontroller,what if it not. Will apple reject my app.(apparently GILT group has been approved)
3) I found MGSplitViewController , can I use that one not as root?
Any help would be appreciated. As a newbi i hope my question is genuine
相关问题
- how do you prevent page scroll in textarea on mobi
- How to change the backgroundColor for all UITableV
- The bundle identifier cannot be changed from the c
- execute method when iPhone enters landscape mode
- iPad Landscape messing up touches began
相关文章
- How do you detect key up / key down events from a
- Can I release an app without the device?
- Universal iPad App rejected because of launch cras
- What does the “Use for Development” button in Xcod
- Does the iOS-Simulator use multiple cores?
- iPad modal form sheet takes up the whole screen an
- UIWebView scaling page so that there is no need fo
- Programmatically Control UIScrollView
Try this, it works for me
1) in app delegate's didFinishLaunchingWithOptions make your login view to root view
also, init the split view as the template do ( but not add to self.window)
2) add a swap view controller in app's delegate, which swap the root view to split viewcontroller.
3) invoke the swapToViewControllers in your login view.
Keep in mind that the HIG strongly encourages you to support all orientations. Unless you have a very, very good reason to support landscape only, you'll probably be rejected.
See page 19 of the HIG: http://developer.apple.com/library/ios/documentation/General/Conceptual/iPadHIG/iPadHIG.pdf
Modified Ryan CY's version with storyboard.
Put this code to login controller.
3. Change rootViewController after login1. Set storyboard id of UISplitViewController to SplitViewController;
2. Set UISplitViewController delegate and save instance
If you want to use the out-of the box splitView it must be root; any hokeary-pokery here will either break apples guidelines or manifest very odd behaviour.
The MGSplitViewController is completely custom implementation of a SplitViewController. Its very good if you need that sort of thing, but some of the features are based round the fact that our app will be orientating.
Alternatively you could make your own. I have done this more than once and is easier than it sounds.
Based on an out-of-the-box UISplitView, I would suggest:
Make the splitView the root View.
Pop (not animated) a full screen Modal as soon as the app starts and allow the user to navigate the loginView, LandingView and collectView in this; i also recommend using a navController here.
Once the user is ready to proceed to the splitView, populate the splitView's rootView Controller and DetailViewController with whatever you want then ,animate the Modal out.
Dave does have a point, but i would look at it from the point of view that you are removing the choice of orientation from the user; removing standard choices (like supported orientations) because the designer assumes some configuration is more efficient will only annoy some users.
I did it by making a method in my
detailViewController
:Then Call it in the
detailViewControllers
ViewDidAppear
method:As for the root disappearing (leaving a big black space)..thats a known bug. though i thought for a while that it was caused by ordering an animation while/just before it was going to draw itself.
Also, i found that if i popped a full screen modal over the splitView then popped another form based modal (for example) quickly after it the full screen modal didn't draw properly.
SplitViews are like your mother-in-law, you don't really like them and when you have to use them you have to tip-toe round the landmines.