开发者

WebView cocoa reloading webpage

I have created a mac application using the WebView. But issue is that webView is reloading when

[webView mainFrameUrl] == newURL
开发者_JAVA百科

why this problem is happening?? how to solve it.


Never compare strings with == You always use NSString's isEqualToString: method to check if the 2 strings are equal.


[[webView mainFrameURL] isEqualToString: newURL]


Besides the fact that the answer of theAmateurProgrammer is the correct one I want to give you another suggestion if it didn't solve your problem (since you didn't accept it).

Don't call mainFrameUrl frequently. Call it once and store it in another variable in the delegate method - (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜