Enable/Disable button using webViewDidFinishLoad

纵饮孤独 提交于 2020-01-07 02:33:23

问题


I'm working on an iOS app, and I need to prevent a UIButton from being usable until the page has finished loading (it uses resources that might not be on the page until it has loaded completely).

Right now, I've disabled the button in Interface Builder and am trying to use setEnabled in the webViewDidFinishLoad function. Here's what it looks like:

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    [activityIndicator stopAnimating];

 [randomButton setEnabled:YES];

}

The activityIndicator stops animating and hides as expected, so I know the page is loading fully. However, the button remains disabled.

How can I enable that button after the webView finishes loading?


回答1:


Are you sure you've hooked up the 'randomButton' variable to the actual button in your .xib file?



来源:https://stackoverflow.com/questions/3859580/enable-disable-button-using-webviewdidfinishload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!