Bug with UISplitviewController? - Pop-over button remains on orientation change

Discussion in 'iPhone/iPad Programming' started by kamy, Jul 27, 2011.

  1. macrumors member

    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.
    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!!

    Can anyone validate this and point what am doing wrong?

    Attached Files:

  2. macrumors 65816


    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];
  3. macrumors member

    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.
  4. macrumors 65816


    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.
  5. macrumors member

    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?

Share This Page