Is this possible? How might I accomplish this?
Allow change of orientation to landscape for only one tab in UITabViewController
981 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
- How to control the volume of an iPhone programmatically in objective-c
- my website crash on safari The site sometimes crashes and I can't recover the crash
- Postal Framework crash in iPhone but runs successfully in simulator
- Xcode 15 building failure when using iphone 15 as simulator, using ios 17
- Images uploaded via Active Storage not displaying in Active Admin or on certain devices
- Any problem with creating provisioning profile with old Iphone?
- Does anyone know how to make iPad layout the same as iPhone's? Size wise the text and overall layout get's smaller when I run the app on the iPad
- Keyboard not appearing when connecting smart card reader to iPhones with type-c port. i.e. iPhone 15/ 15 pro
- Access the list of SIM mobile numbers installed in the iPhone
- Can we produce haptics and record from microphone the haptic sound at the same time on iOS?
- SwiftUI's localized string do not load from main bundle despite using the main bundle identifier (an xcode bug?)
- Cordova iOS only app upload through transport requires WKWatchKitApp
- Amazon s3 video is not played on Iphone
- build getting failed for ios xcode build -flutter app
- "Error when Importing 'mysdk' into iOS Demo App: dyld Library not loaded: @rpath/MQTTClient.framework/MQTTClient"
Related Questions in IOS
- URLSession requesting JSON array from server not working
- Incorrect display of LinearGradientBrush in IOS
- Module not found when building flutter app for IOS
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- Expo Deep linking on iOS is not working (because of Google sign-in?)
- On iOS, the keyboard does not offer a 6-character SMS code
- Hi, there is an error happened when I build my flutter app, after I'm installing firebase packages occurs that error
- The copy/paste functionalities don't work only on iOS in the Flutter app
- Hide LiveActivityIntent Button from Shortcuts App
- While Running Github Actions Pipeline: No Signing Certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID
- Actionable notification api call not working in background
- Accessibility : Full keyboard access with scroll view in swiftui
- There is a problem with the request entity - You are not allowed to create 'iOS' profile with App ID 'XXXX'
- I am getting "binding has not yet been initialized" error when trying to connect firebase with flutter
Related Questions in OBJECTIVE-C
- How to control the volume of an iPhone programmatically in objective-c
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- How to set value the descriptor of iOS BLE in Objective-C?
- Unexpected #selector() Behavior in Swift-Objective-C Interop?
- In what context can we use an unqualified #selector() expression in Swift?
- AVPictureInPictureController crashes during initialization
- How to use pow() in Objective-C?
- How to change the image on the MGSwipeButton in MGSwipeTableCell
- Using sort descriptors in Outline View
- Why is my Swift function not printing from inside the dataTask closure?
- Using UICollectionViewCell with IBOutlet
- Undefined symbol: _OBJC_CLASS_$_ only on simulator
- Why can't I receive a notification sent from Camera Extension(Swift) to an observer application (obj-c++)
- Behavior of __block modifier in objc
- Inserting subview into view where I've added subviews and sublayers
Related Questions in DEVICE-ORIENTATION
- deviceorientation alpha is wrong every time I turn off my screen
- Ipad Orientation landscape mode is not working
- Stellarium-web canvas navigation through device sensors
- iOS Camera didFinishProcessingPhoto always giving random wrong orientations
- How can I listen to Screen Rotations in React Native, including e.g. a rotation from landscape-left to landscape-right?
- Google Maps API Integration in React: Achieving Stable User Location and Device Orientation
- toolbar items have no dimensions (width, height, left, right, ...) after a configuration change
- WPF: How to read video orientation (i.e. side data: displaymatrix) in mp4 with TagLibSharp?
- How to fetch device auto rotation is on or off in flutter using native code
- Moving Three.js camera using device orientation - Strange behavior when the device is placed vertically
- Set camera to look at a specific place when using device orientation controls in Panolens.js
- Turning Safari's device orientation into absolute device orientation
- React-native flatlist item layout should adapt device orientation change
- Ionic and Cordova ios deviceorientation
- SwiftUI animated background view adjust width according to size changes (orientation)
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