Handle different view controllers to achieve different views at orientation change - view

I have a universal app that i need to present different screen for ipad depending if the device is portrait or landscape. I am using storyboards and view controllers. In the ipad storyboard I have one view controller for Portrait and one for landscape both pointing to the same .m class and each has an identifier name.
At the didRotate method in each .m file i tried to load the correct view cotroller based on its identifier name and i used push in the navigation controller. But in this way the back button doesnt lead back to the correct orientation of the previous view.

Related

UISplitViewController.presentsWithGesture doesn't work when style != Unspecified

I tried to update the UISplitViewController in my old iOS project to use the newer column-based API, but noticed that when setting the Style to Double Column in IB from the currently selected Unspecified (Discouraged), the swipe gesture doesn't show and hide the master view controller anymore, even if the option Presents Primary With Gesture is selected. This also happens with a fresh project where I dragged the standard split view controller into the IB canvas as the initial view controller. Is this expected or am I missing something?

Segues initiated directly from view controllers must have an identifier

I'm seeing this warning in a project with regard to storyboard:
warning: Unsupported Configuration: Segues initiated directly from view controllers must have an identifier.
Segues initiated directly from view controllers must have an identifier.
Ideas on how to know specifically which segues?
Open Storyboard
Search for push segue to or segue to in bottom of search area like image attached
Hope it helps.

How to incorporate a UISearchController into new (iOS8) UISplitviewController

I try to build a simple app based on the UISplitViewController template from Xcode 6 for universal apps (with Storyboard and CoreData/NSFetchedResultsController). This app should also provide a search bar for the MasterViewController. Unfortunately, Xcode 6 provides no InterfaceBuilder element for the UISearchBar/UISearchController combo (only the depreciated UISearchBar/UISearchDisplayController).
In the iOS Developer library, Apple provides the "Table Search with UISearchController" example, but this is not based on the UISplitViewController and supports only iPhone.
My problem is, that I'm not able to show the detail view on the correct ViewController under all circumstances. I tried to transfer the approach from the Apple example project to the UISplitViewController template. In this, one is encouraged to show the search results in a separate UITableViewController subclass (ResultsTableViewController) and use this as the searchResultsController of the UISearchController. I was not able to create a scene in InterfaceBuilder for this setup so I had to add these manually in code.
The problems begin when I click on a table cell of the ResultsTableViewController. This vc is not part of the scene in InterfaceBuilde and I don't know how to add it to the SplitViewController setting correctly. The biggest problem is the weird behavoir of the iPhone 6 Plus and the UISplitViewController. In portrait mode it behaves like an iPhone and doesn't seem to have a SplitViewController and only uses a NavigationController to which I push my DetailViewController. In landscape mode it behaves like an iPad with SplitViewController were I have to get the second ViewController of the SplitViewController childControllers and push the DetailViewController on this one.
Now it happens, when I start in portrait mode and switch to landscape mode that the DetailViewController is all gone, showing gray space where the DetailVC should be. It seems, when going to portrait mode, the DetailViewController gets kicked from the SplitViewController (or the SplitViewController gets kicked at all in favor for the iPhones NavigationController setup). When switching back to landscape the SplitViewController is initialized again but without proper initialization of the DetailViewController.
Is there any template or suggestion on how to correctly implement search capabilities on a universal UISplitViewController?
Cheers
Björn

iOS 7 force landscape on a UIViewController with UINavigationController

In my app I want one view controller to be shown in landscape because it is a signature pad. The rest of the views are portrait. I can force the view to be landscape without a problem as long as it is not embedded in a Navigation Controller. The problem is that I want the Navigation bar to show also. Does anyone know a workaround for this?
You can either present your view controller instead of push using UINavigationController (See kjam's solution in the following link) or you may try this solution of arpan_techisavy.

Xcode 4.5 build Device IOS 5.1

I'm running on Mt Lion with Xcode 4.5.1 installed.
By default, when I build and deploy to a iOS 5.1 device, the display would rotate when I rotate the device but it doesn't seems to work when I deploy to either the iOS 6 simulator or my iPad or iPhone running iOS 6.
Is there something I'm missing here?
Please read the following, hope it help. (referencehttp://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html)
Handling View Rotations
In iOS 6, your app supports the interface orientations defined in your app’s Info.plist file. A view controller can override the supportedInterfaceOrientations method to limit the list of supported orientations. Generally, the system calls this method only on the root view controller of the window or a view controller presented to fill the entire screen; child view controllers use the portion of the window provided for them by their parent view controller and no longer participate in directly in decisions about what rotations are supported. The intersection of the app’s orientation mask and the view controller’s orientation mask is used to determine which orientations a view controller can be rotated into.
You can override the preferredInterfaceOrientationForPresentation for a view controller that is intended to be presented full screen in a specific orientation.
In iOS 5 and earlier, the UIViewController class displays views in portrait mode only. To support additional orientations, you must override the shouldAutorotateToInterfaceOrientation: method and return YES for any orientations your subclass supports. If the autoresizing properties of your views are configured correctly, that may be all you have to do. However, the UIViewController class provides additional hooks for you to implement additional behaviors as needed. Generally, if your view controller is intended to be used as a child view controller, it should support all interface orientations.
and this link may be helpful for you http://www.cocos2d-iphone.org/forum/topic/40721
there are some interesting comment from the link above -> Try to override the shouldAutoRotate method on the rvc, and put the conditional there. As far as I have tested, the shouldAutoRotateToInterfaceOrientation isn't called on iOS6 even with all fixes applied, so I was forced to override several more methods.
please give me a feedback, thanks :)

Resources