从app delegate重新加载webview无法正常工作

时间:2013-04-04 06:40:00

标签: ios objective-c uiwebview

当我的应用程序到达前台时,我想在视图控制器中重新加载webview。我在应用程序委托的-applicationWillEnterForeground-applicationDidBecomeActive方法中创建了一个视图控制器对象。但我无法刷新我的网页视图。

2 个答案:

答案 0 :(得分:0)

applicationWillEnterForeground可能不是最好的方法。

在包含webView的类中添加如下通知方法

[[NSNotificationCenter defaultCenter] addObserver:self
 selector:@selector(didEnterForeground)
 name:UIApplicationWillEnterForegroundNotification
 object:nil];

-(void) didEnterForeGround
{
//[webView reload];
}

答案 1 :(得分:0)

当你的应用程序来到Foreground时,app是活动状态,特别是viewdidload或viewdidAppear方法[WEBVIEW ReloadData]上的视图控制器;就是这样,你不想在appdelegate类做任何事情