On Wed, Jul 13, 2011 at 3:00 PM, Jeffrey Walton <noloa...@gmail.com> wrote:
> I've been testing refreshing my views in a split view. If the user
> brings the app to the foreground, I'm processing both the
> application's -applicationDidBecomeActive and the view controller's
> -viewWillAppear. -applicationDidBecomeActive sends a message
> (-refreshView) to all view controllers. Sensing activation works as
> expected.
>
> However, the only view I can get to refresh is the DetailView - not
> the BarButtonItem (in portrait view), and not the TableView (in
> Landscape). If I rotate the iPad, the views update as expected.
>
> According to "iPad-Specific Controllers" [1]: "At this point
> [popoverControllerDidDismissPopover message is sent], it is safe to
> release the popover controller if you do not plan to use it again. You
> can also use this message to refresh your user interface or update
> your application’s state." Waiting for
> -popoverControllerDidDismissPopover is not working well.
>
> I've tried forcing a reload of the table (in RootView) with
> -reloadData followed by a -setNeedsDisplay on the view. I've also
> tried enumerating the view controllers in RootView (ie, SplitView,
> Navigation controller and all their children) and sending
> -setNeedsDisplay with no joy.
>
> Any ideas how to refresh the menu items and bar button? I've found if
> the user changes their language, the UI is half using the old
> language, and half using the new language until a rotate.
Found what I was doing wrong (in case others stumble upon this): In
AppDelegate's -applicationDidBecomeActive, I performed the following:

NSArray* controllers = [splitViewController viewControllers];
for(UIViewController vc in controllers)
{
    if([vc respondsToSelector:@selector(myAppDidBecomeActive)])
        [vc myAppDidBecomeActive];
}

Unfortunately, the above does not return the RootViewController (but
does return the DetailViewController). The RootViewController is a
child of one of the items returned, so something similar to the
following was required:

NSArray* controllers = [splitViewController viewControllers];
for(UIViewController vc1 in controllers)
{
    if([vc1 respondsToSelector:@selector(myAppDidBecomeActive)])
        [vc1 myAppDidBecomeActive];

    NSArray* moreControllers = [vc1 viewControllers];
    for(UIViewController vc2 in moreControllers)
    {
        if([vc2 respondsToSelector:@selector(myAppDidBecomeActive)])
            [vc2 myAppDidBecomeActive];
    }
}

Jeff
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to