Is this possible? How might I accomplish this?
Allow change of orientation to landscape for only one tab in UITabViewController
979 Views Asked by esreli At
2
There are 2 best solutions below
0
Andy Obusek
On
Not possible according to Apple Docs. All UIViewControllers must support the same orientations for any to be rotatable.
See this document (scroll down to the section titled "Tab Bar Controllers and Rotation": http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/TabBarControllers.html#//apple_ref/doc/uid/TP40011313-CH3-SW1
Related Questions in IPHONE
- UIWebView Screen Fitting Issue
- ios responsive design not working (too wide in portrait orientation)
- Setting View orientation to portrait is ignored
- How do I add custom cells to TableView in Swift?
- UIWebView not loading URL in simulator
- What is the limit for number of subscribers to a stream(publisher's) in opentok/tokbox iOS SDK?
- How to generate request format for WCF web service method for Mac and iPhone
- Difference between gethostname() and [NSProcessInfo hostName]?
- How to force close ipad/iphone keypad when input element is not focused using JS?
- iOS app rejected because of in-app purchase
- iOS coordinates for iPad and iPhone game using spritekit
- What is the best practice when making a storyboard for iPhone and iPad?
- Labels properties changing in Xcode
- Terminating app due to uncaught exception
- Exchange plist data between 2 iPad using iCloud
Related Questions in IOS
- Overlapping UICollectionView in storyboard
- Cannot pod spec lint because of undeclared type errors
- Is the transactionReceipt data present in dataWithContentsOfURL?
- UIWebView Screen Fitting Issue
- ZXingObjC encoding issues
- iOS: None of the valid provisioning profiles allowed the specific entitlements
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Slow performance on ipad erasing image
- Swift code with multiple NSDateFormatter - optimization
- iOS 8.3 Safari crashes on input type=file
- TTTTimeIntervalFormatter always returns strings in English
- How do I add multiple in app purchases in Swift Spritekit?
- Setup code for xibs in iOS. -awakFromNb:
- iOS Voice Over only reads out the title of any alert views
Related Questions in OBJECTIVE-C
- How do I customize NSOutlineView to have border color?
- UIWebView Screen Fitting Issue
- How to hide "Now playing url" in control center
- CloudKit: Preventing Duplicate Records
- Image and Text locations in UIButton
- setting OpenGL version in objective-C
- Setup code for xibs in iOS. -awakFromNb:
- realm db, get parent link of object
- CFBundleDocumentType is not working in myproject-Info.plist file
- UIPopoverPresentationController not rendering properly
- Using Storyboard Reference
- Pass Data between two view controllers using 'Delegation' : Objective-C
- Unexpected CALayer Vertical Flipping on 3D Rotation 'Bounce'
- Setting View orientation to portrait is ignored
- UITextField append / between dates while enforcing character limit
Related Questions in DEVICE-ORIENTATION
- Launching landscape app according to iOS human interface guidelines
- UITableViewHeader doesn't maintain position when device rotates
- UIView rotation doesn't work properly in Swift
- Arbitrary direction for DeviceOrientationControls
- Detect phone rotation in Javascript Windows Phone mobile application
- DeviceOrientationEvent: how to deal with crazy gamma when beta approaches/hits 90deg?
- How to present a view controller in portrait or landscape, in application that is portrait-only
- Set iPhone native popup's orientation
- Compass not working on my mobile devices in Chrome 39
- iOS8 Device appears stuck in portrait, but rendering landscape
- Get HTML5 deviceMotion events fire at a higher rate
- Autolayout and Device Orientation
- Set UITextVIew position on device orientation
- My app does not support Portrait mode but at times it turning into portrait mode
- Auto rotation or the views
Related Questions in UITABVIEW
- How do I make a view that stays onscreen when the main view segues?
- From initial View Controller how to segue acriss to a UITabBarController and use prepareForSegue
- Memory warning doesn't work properly
- NavBar not showing up in second and third viewcontroller
- Pass a paramether to a view transition
- As soon as I make a connection between my code and interface, my tab crashes (iOS SDK 4.2)
- iphone tab app architecture question
- iOS tabbed application with table view, how to reset table view tab? Beginner.
- xcode: creating a viewController for a tab item in StoryBoard results in a black screen
- Allow change of orientation to landscape for only one tab in UITabViewController
- UINavigationController with UITabViewController
- ScrollView with Images - changing tabs on touchesended does not work
- UITabViewController hide / make appear a view in code
- How to display the tabs when click the back button from hided tab view controller
- perform a method every time a tab is selected
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The word possible may need an asterisk by it. It certainly looks like Apple didn't envision (or want) you doing this. But, depending on what your requirements are, there may be a workaround.
Disclaimer: this is kind of a hack. I'm not claiming this to be a good UI, just trying to show Eli what's possible.
I built an example, starting with the Xcode template for building a Tabbed Application. It has two view controllers:
FirstViewControllerandSecondViewController. I decided to makeFirstViewControllerthe landscape-only view. In Interface Builder (Xcode UI design mode), I set the orientation of the FirstViewController's view to landscape, and made its size 480 wide by 251 high (I'm assuming iPhone/iPod here).Solution
Now, what seems to be necessary is to have all the tab bar's view controllers claim to support autorotation to portrait and landscape. For example:
So, both my view controllers have that same code. However, what I do in
FirstViewControlleris to also overridewillAnimateToInterfaceOrientation:duration:and essentially undo what theUIViewControllerinfrastructure does, just for this one landscape-only view controller.FirstViewController.m:
What you get with this is that the tab bar will always rotate with the device. That's probably a requirement, to get your dual orientation views (e.g.
SecondViewController) to do autorotation. But, the actual view content ofFirstViewControllernow does not rotate. It stays in landscape orientation, no matter how the user turns the device. So, maybe that's partially good enough for you?Also of note:
1) I changed the app's info plist file to set the initial orientation to landscape (since my
FirstViewControllerwas the landscape one):2) In FirstViewController.xib, I set the main/parent
UIViewto not Autoresize Subviews. Depending on your view hierarchy, you may want to change this property in other child views, too. You can experiment with that setting.Now, the available size for your landscape view does change a little bit, as the status bar and tab bar are rotated. So, you may need to adjust your layout a little bit. But, basically, you will still get a wide view for showing landscape content, no matter how the user holds their device.
Results
Watch Youtube demo of running app