UISplitView with UITabbar - ios

I have a strange one that I can not seem to fix. I am currently working on updating my app to iOS7. This all worked in iOS6. It is an universal app and thus uses same xib files. However the iPad uses UISplitViews on some. Like I said, this all worked in iOS6 oh this all works on the iPhone too.
The problem is a grey bar at the bottom. I changed the tab bar to be opaque to move views up properly as i had some UI clipped to bottom of views and that went underneath the tab bar, sidetracked there. But if i set it back to translucent bar, it goes underneath but stretched properly. if i dont, it adds a bar. Other tabs work fine when NOT using splitview.
The UISplitviewController is added programmatically.
See attached image for better description.
This I have tried:
Added autoresize on splitview
Checked xib for subviews in the splitviews to have auto resize
Tried to force splitview to be screen bounds
Removed clips to bounds on all views
Removed autoresize subviews
Any ideas would be welcomed.
Thank you all.
UPDATE:
setting the background colour the uisplitview, it does colour the bar black. So the uisplitview is definitely stretching to it.

I subclassed UISplitViewController and added the line below to viewDidLoad and that fixed the grey line.
self.extendedLayoutIncludesOpaqueBars = YES;

I believe I have found an alternative solution for you. I have had the exact same problem, mostly because we are both doing something against Apple's Guidelines which is having a SplitViewController nested within a Tabbar controller (SplitView should be the root view). This was okay in iOS 5/6, but now in iOS 7 there are far too many side effects to achieve this.
The reason you see your view stretch completely when you set the bar to be translucent is because the bar is NOT taken into account when drawing the view. When you set translucent to false, it is then taken into account of the view and you will see that grey bar there because that's your view pretending there's a tabbar at the bottom of the screen.
And as always, a SplitViewcontroller's height cannot be changed, as it is determined by the visible window height.
I tried everything you did and then some. The real solution came from using a third-party Split View Controller.
I recommend switching over to https://github.com/mattgemmell/MGSplitViewController . This split view controller is actually one large View with container views living inside of it. Because of this, you avoid all the side effects of putting an actual split view controller within a tab bar.
If that doesn't float your boat, you could create your own solution which follows the same idea of having one UIViewController with two container views contained in it, though the people behind MGSplitViewController did a good job of that already.
This was the only way I was able to solve this issue, let me know if you find an alternative.

Instead of creating a subclass for UISplitViewController, I just added this code on my master's viewDidLoad:
self.splitViewController?.extendedLayoutIncludesOpaqueBars = true

For the controller that is the detail view of UISplitViewController you just do this:
-(UITabBarController*)tabBarController{
return nil;
}

Related

Gray bar visible on iPhoneXS throughout app

Header image with gray bar on top
I am converting our app to fit correctly on newer iOS devices. We are using xib files for the UI. I added a launch screen storyboard to start off the new formatting. I noticed a gray bar across the top of every screen. It is not part of the view controller and I've tried removing the status bar but that only makes the text and icons disappear. I don't think it's the navigation bar either since we have that hidden as well. I have checked the Safe Area Layouts.
Any ideas on what this is and how I can remove it to extend my view all the way to the top? The blue in the image is the color I currently set the background of my view controller and we have a custom header view below that.
Using the View Hierarchy, as suggested, I was able to see the view behind my main view. I inspected the code for that initial view and found the previous developers had offset the Navigation Controller by 20. That is what created the bar on all the views. I have adjusted to remove the offset and it looks perfect now.

iPad UITableView top right corner covered with white box in landscape popover

I am attempting to create a custom popover for an iPad application in landscape orientation. I created a new UITableViewController with static cells on my storyboard and set the size setting to "free form". I then set the size of the UITableView to my desired size. I connected a Modal segue from the parent controller to the new popover.
Then in the parent UIViewController I created a method that performs the segue through a custom presenter. After working through a bug in Apple's orientation handling routines, I got the popover to show at the correct location.
When I run the app, I then discovered that in the top right hand corner of the UITableView a white box is displayed that covers whatever I place in the UITableViewCell. The more cells I place in the table the longer this white box appears. So I believe it has something to do with the UITableViewCell not orienting properly although I have not figured out what yet.
I cannot seem to find what this box is, nor have I had any luck getting rid of it. Has anyone seen something like this? Any help to get this white box remove (or whatever is needed to get the cells working correctly again), will be greatly appreciated.
Thanks in advance
For anyone who is interested, I was able to work around this problem. It turns out that there is a bug in the modal segue logic that does not handle landscape orientation. So I created a XIB and presented that as my modal view. I still need to adjust things since it is landscape but the view displays correctly.
From what I understand this storyboard bug should be fixed soon.

iPhone: hiding a custom view under the navigation bar

For the app I working on, I am implementing a control that is similar to the notification view on iOS. So, I am working on dragging a view down from under the navigation bar of the UIViewController.
My question is whether there's a way to position a view that is MOSTLY hidden under the navigation bar?? The goal is to have just a few pixels visible, so that there's a way to grab it and drag down.
Thanks!!
Alright, resolved this issue myself. Turns out what works for me is having a custom view and then adding that view in IB in the order where nav bar comes after that custom view.
Another trick was to figure out how to initialize/embed that custom view and for that I found help here: UIView subclass with its own XIB

iOS not rotating

I have a view controller with a navigation item. The view inside the navigation item rotates, but the navigation bar at top does not. I don't understand why only part of the application is rotating.
There's seems to be pretty much about this in google.
This one looks promising
UINavigationBar autoresizing

Toolbar hiding on rotated UISplitView DetailView

I've based my app on Apple's SplitView project type. I have a TableView as the Master, and am using different types of views as the Detail view. To select types of detail view, I'm using the fancy concept of buttons on my DetailView toolbar. When the DetailView is derived from UIViewController, everything is good. When the DetailView derives from UIViewController, but contains a UITableView then I have problems. In portrait view the toolbar is visible. In landscape mode the toolbar is hidden, even though the Tableview is moved down to allow space for it. The UIToolbar and UITableView are both defined in my NIB file which is loaded to create the detail view. Why is my toolbar invisible in landscape?
BTW, is this the best way to choose Detail view types with UISplitView? Bonus question, what if selecting a row in my DetailView tableview should bring up another View, I can't push it like I would with a NaviagtionController, so how do I go back to the detail tableview?
Thanks, Gerry
HI Gerry,
I have faced the same toolbar problem, when trying to rotate the splitView, toolbar will disappear. If you are creating the toolbar in the interface builder, try to set the toolbar properties(size), by selecting the toolbar, then --> Tools -->Size inspector, in the autosizing section, mark the left, right and upper red lines and unmark the bottom red line, then everything will works fine.
-Maria
Bonus question, I would create a UINavigationController in code, set it's rootcontroller to the DetailView tableview (self) and then push the new view on top of it.
When you react to the rotation change are you using the same view or a different one for the detail view? Seems like the new view may not contain an instance of the toolbar? Or the Tableview is covering it up because the landscape view has less vertical room than the portrait view. Are you resetting the height of the tableview to allow space for the toolbar within the 768 height when rotating to landscape?
Just a tip but whenever I run into odd things like this I remove the elements from the NIB file and create them programmatically in code and it usually solves the problem. You get a lot more control over things when you do. Overall as I've gained more experience with programming for iPhone OS I've found that I rarely put much into a NIB file any longer and do almost everything in code now.

Resources