Using MGSplitViewController Inside Tab - ios

I have a UISplitViewController inside a tab bar. I know this is not officially supported by Apple, but it did work for iOS 5/6. In iOS 7 I am getting a grey bar at the bottom of the screen similar to the one shown in this post:
UISplitView with UITabbar
I followed the advice and tried the MGSplitViewController. It seemed to work perfectly, I merely changed my type and presto it all came up as expected. A new problem occurs however. The other tabs have stopped rotating. The tab containing the mgsplitview rotates, the others don't.
Has anyone experienced this before? Is there a quick solution?
Thanks

change height -= statusBarHeight;
with
if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1) {
height -= statusBarHeight;
}
in MGSplitviewController

This worked for me also:
I subclassed UISplitViewController and added the line below to viewDidLoad and that fixed the grey line.
self.extendedLayoutIncludesOpaqueBars = YES;

Related

UISplitViewController preferredPrimaryColumnWidthFraction not working on iPhone iOS 9

I've added a UISPlitViewController to the Main.storyboard and try to change the preferredPrimaryColumnWidthFraction = 0.5 property to make my master controller be the half screen instead of covering full screen, but it doesn't work at all. I've tried changing maximumPrimaryColumnWidth and minimumPrimaryColumnWidth but none of these seem to work. I wonder what am I missing for this to work.
I am currently working on an app with UISplitViewController and maximumPrimaryColumnWidth seems to work fine for me.
Make sure you are setting the delegate for UISplitViewController like
self.splitViewController.delegate = self;
And then the primary column width as:
self.splitViewController.maximumPrimaryColumnWidth = 320; // set the width based on screen needs.

iOS 8.3 pushViewController shows empty view first, then view is shown

iOS 8.3 changed the behavior of pushViewController to show blank view first, then the view is shown. Any tips to fix this issue?
Same code on different iOS versions
iOS 8.3 broken behavior: https://vid.me/4JDf
iOS 8.2 expected behavior: https://vid.me/qgvA
The basic code that pushes the view:
[self.navigationController pushViewController:view animated:YES];
PS: The VC's code is under NDA, sadly I can not share it.
Please set background color for view.view any color except clear color
This seems like a layout clash issue in the new view. Commenting out some layout based code solved the issue. Basically we had more layoutIfNeeded than needed.
[self.view layoutIfNeeded];

Dark background behind UINavigationBar in push transition from UICollectionViewController with iOS 7.1

I'm having a little problem when trying to go to the next UIViewController from a UICollectionViewController. The problem is: While the next view is pushed, a black background seems to be added behind the right side of the navigation bar. I tried to replace the next view controller but the problem is still there. But when replacing the UICollectionViewController with another one, the problem vanishes.
Note: this problem seems to be an iOS 7.1 bug. Because i don't remember that it happened before I updated my devices.
Here is a Video of my problem if you didn't understand me
Anyone can help ?
Thank you all in advance and sorry for my english,
Bader
Setting self.navigationController.view.backgroundColor to the color you want will solve this problem.
I had exactly the same problem.
It's a bug.
UINavigationController view has a black background, and it spoils translucent Navigation Bar at transition time.
To resolve this issue, you should change background of UINavigationController in code by this way:
self.navigationController.view.backgroundColor = [UIColor whiteColor];
Or set view color of UINavigationController in Interface Builder:
Ok, i finally knew what caused this problem. That was because i added an ILTranslucentView as a subview of a UICollectionView cell. Also, using a UIToolbar instead causes the same issue ( i still believe this is an iOS 7.1 bug because this wasn't happening before ).
Solution: remove any UIToolbar from your view controller.
While the next view is pushed, in that view controller’s .m file remove self.edgesForExtendedLayout = UIRectEdgeNone; if you wrote in your code.
self.navigationController.navigationBar.translucent = NO

Top half of UINavigationBar on iOS6 not responding to taps

I'm working on an iPhone app and have the strangest issue.
On iOS 6, buttons on the navigation bar are completely ignoring taps in the top half. Have a look at the image below, I have roughly selected tap areas of my navbar buttons:
https://www.dropbox.com/s/izs6ic5jlubm1yk/navtap_problem.png
Here's some, potentially useful, information:
the app supports iOS 6 and 7
the app is not using autolayout (working with deltas instead)
this issue is present only on iOS 6, it's working fine on iOS 7
the issue is present in all views across the app (that have a navigation bar on top)
the issue present in both navigation bars that are manually added in IB as well as in navigation bars that are coming from the UINavigationController
the problem is not present if I directly start the app from one of affected view controllers
the problem is present when I start the app through my empty InitialViewController and load another VC
I'm using ECSlidingViewController and loading the real VC (that users will see) from the InitialViewController like this:
self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"SearchSplitViewNavigationController"];
[self resetTopView];
It looks like something invisible is covering the top half of the navigation screen. I checked the contents of self.view.subviews, but didn't see anything there.
Any ideas what might be causing this? Or what else could I check?
If you are including any element programmatically, then that element isn't using the deltas you are including through the storyboard.
For these elements you must test for the iOS version you're in and adjust the delta in code.
Check this: Best Way to check for iOS 7 or earlier? for help on the version checking.
I've found a solution (not the cause though). This awesome library helped me a lot to identify the problem.
There was actually a transparent UIView sitting on top of my navigation bars. It was located at 0,20 and had a height of 20 points.
That view is not in the self.view.subviews array, but doing [self.view bringSubviewToFront:myNavigationBar] seems to do the trick...

View drops 20 pixels when build against iOS 6 SDK in Xcode 4.5

After building my iPad app against iOS 6.0 SDK, I get this weird behavior with my UISplitViewController's detailed view. The detailed view is positioned 20 pixels (points / 40 pixels) lower than it should be.
Here is what it looked like under 5.1:
For DetailViewController_iPad.xib in Interface Builder I've set the Simulated Metrics > Top Bar to None. This didn't help.
I've logged the view frame:
- (void) viewDidLayoutSubviews {
//.. etc
NSLog(#"viewDidLayoutSubviews: %#", CGRectCreateDictionaryRepresentation(self.view.frame) );
}
This logs the height as 684 instead of the what it should be: 704.
Height = 684; Width = 703; X = 0; Y = 0;
Anyone have any experience with this sort of thing? What should I try next?
UPDATE: This problem seems intermittent, with some compiles causing it, and some not.
If anyone else has had this problem and found out what causes it, I'd still be keen to know.
I had the exact same issue!
The issue will occur when there is another view controller in the navigation controller and this split view controller is pushed in the method application:didFinishLaunchingWithOptions: during app launch.
This fixed the problem for me:
When pushing the splitViewController I used
dispatch_async(dispatch_get_main_queue(), ^{
[self.navigationController pushViewController:splitViewController animated:NO];
})
instead of
[self.navigationController pushViewController:splitViewController animated:NO];
I used this only for iOS6 otherwise first view will be momentarily showed in OS < iOS6.
I'm assuming you're not doing anything to effect the frame of the view in code, correct? It's the view's controller that's doing all the layout? If so, have you tried tinkering with -wantsFullScreenLayout?
When a view controller presents its view, it normally shrinks that view so that its frame does not overlap the device’s status bar. Setting this property to YES causes the view controller to size its view so that it fills the entire screen, including the area under the status bar. (Of course, for this to happen, the window hosting the view controller must itself be sized to fill the entire screen, including the area underneath the status bar.) You would typically set this property to YES in cases where you have a translucent status bar and want your view’s content to be visible behind that view.
If this property is YES, the view is not resized in a way that would cause it to underlap a tab bar but is resized to underlap translucent toolbars. Regardless of the value of this property, navigation controllers always allow views to underlap translucent navigation bars.
The default value of this property is NO, which causes the view to be laid out so it does not underlap the status bar.
Mind you, -wantsFullScreenLayout should really only effect a window's root view controller. So if this fixes your problem (and you're not doing anything goofy with your view controller hierarchy), please file a bug with Apple!
Maybe [UIViewController statusBarHidden] is set to NO on your detail controller?
Xcode 4.5 has a habit of applying autolayout, which may be the cause of some of your grief - inspect this and trying deselecting it.
have you set autosizng property of height in xib file or programmatically, if yes try removing them and see if it helps the problem.
May help.
I was also affected with same issue i had just reduce size of view in my example:
I have 480px height in XIB for iPhone Apps and i reduce it to 460px.
Please same do for iPad not sure but may help.
I got the same problem when i tried to present another viewcontroller in ViewWillAppear method. I got it solved by moving my presentViewController code to ViewDidAppear method. Hope it will help.

Resources