webView.loadRequest() not correctly loading webpage in iOS Swift -


i have 2 viewcontrollers, trying pass nsurlrequest through delegate. here delegate:

protocol urlrequestdelegate{      func urlrequest(url: nsurlrequest) } 

the delegate passing nsurlrequest, because have error checked it. in viewcontroller delegate passing nsurlrequest to, have implemented required function conform protocol use function webview.loadrequest() load webview desired webpage.

the webview done through code , not storyboard:

var webview: uiwebview = uiwebview(frame: cgrect(x: 0, y: 0, width: uiscreen.mainscreen().bounds.width, height: uiscreen.mainscreen().bounds.height)) 

here function:

func urlrequest(url: nsurlrequest) {      //load url delegate.     webview.loadrequest(url) } 

but does't load uiwebview nsurlrequest passed in delegate, thinking delegate method func urlrequest() isn't calling correctly or maybe before viewdidload() method.

i have set self.view.webview.delegate = selfand implemented uiwebviewdelegate on class , implemented func viewdidstartload() & fun viewdidfinishload println() inside them check see if codes being run when call webview.loadrequest(url) never seem printed of.

so leaves me puzzled, because i'm not quite sure causing .loadrequest() not function correctly within delegate method func urlrequest().

i know if put .loadrequest() within viewdidload() lets hardcoded url of http://www.google.com work. can't pass delegates nsurlrequest within viewdidload() has implemented inside func urlrequest() conform correctly protocol.

did make sure set delegate first viewcontroller? first viewcontroller needs have property of type urlrequestdelegate , need set property equal second viewcontroller @ point.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -