开发者

Refresh tableview on enterforeground

开发者 https://www.devze.com 2023-04-10 12:05 出处:网络
I have a tab bar application with five views. I need to refresh the second view when the app returns from background, but only if the user was before 开发者_JAVA技巧in that view.

I have a tab bar application with five views. I need to refresh the second view when the app returns from background, but only if the user was before 开发者_JAVA技巧in that view.

I tried :

- (id)init
{
    self = [super init];
    if (self) {
        [[NSNotificationCenter defaultCenter] addObserver:self 
                                                 selector:@selector(reloadThisView:) 
                                                     name:UIApplicationWillEnterForegroundNotification 
                                                   object:nil];
        // Do some more stuff
    }
    return self;
}

- (void)reloadThisView:(NSNotification *)notification
{
    [self getAllLista];
}

But I don't use and don't know how to use init in this case at all…

Any suggestions?

0

精彩评论

暂无评论...
验证码 换一张
取 消