PDA

View Full Version : Bug with UISplitviewController? - Pop-over button remains on orientation change




kamy
Jul 27, 2011, 05:00 AM
hey guys,

To illustrate the issue, which i think is a bug with UISplitViewController, i have created a sample project which creates
3 tabs at the bottom - the first tab has a splitview controller with master and detail views, the second tab has a view and the 3rd tab also has another splitview controller with master and detail views.

The xcode project and files are attached as a .zip.

We will need 4.3 SDK as base SDK.
STEPS
Run the app in portrait mode.
We can see the 3 tabs
Tab 1 - SplitView1
Tab 2 - Ordinary View
Tab 3 - SplitView2

Go to Tab1 and Tab3 - we can see the popover button on the toolbar.
Go to Tab1 - Switch to landscape - popover button dissapears
Go to Tab3 - popover button remains in landspace mode!!

BUG!
Can anyone validate this and point what am doing wrong?



jnoxx
Jul 27, 2011, 05:43 AM
Did you tried setting breakpoints?
I can't really download your project at work, but you sure u have this implemented well?

- (void)splitViewController:(UISplitViewController*)svc
willShowViewController:(UIViewController *)aViewController
invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
[[self navigationItem] setLeftBarButtonItem:nil];
[self setPopoverController:nil];
}

kamy
Jul 27, 2011, 05:50 AM
Did you tried setting breakpoints?
I can't really download your project at work, but you sure u have this implemented well?

- (void)splitViewController:(UISplitViewController*)svc
willShowViewController:(UIViewController *)aViewController
invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
[[self navigationItem] setLeftBarButtonItem:nil];
[self setPopoverController:nil];
}

jnoxx - thanx for replying.

I have implemented 'willShowViewController' and 'willHideViewController' for both the splitview controllers.

After further analysis/testing, it turns out that, if we have 2 splitviewcontrollers inside a tabviewcontroller, on ORIENTATION change

only the active split view will invoke
willHideViewController and willShowViewController methods of its delegate....

The inactive splitview (the view that is not seen by the user), does not fire the willHideViewController and willShowViewController methods of
its delegate..

You will get an idea if you run my code.

jnoxx
Jul 27, 2011, 06:16 AM
I won't download your code atm. But why you need 2 splitviewControllers, can't u think of something better to use, more of guideline uses? :)
Or use a ready to go library with what you want.

kamy
Jul 27, 2011, 06:22 AM
I won't download your code atm. But why you need 2 splitviewControllers, can't u think of something better to use, more of guideline uses? :)
Or use a ready to go library with what you want.

hey jnoxx - sure, please download my code whenever u get time. You will get a good picture....

Now the reason i use 2 splitviews is bcos, i have 3 TABS and 2 tabs open up views, which have master-detail functionality....in that case the option is to use SplitView controllers for both the views, right?