iphone - Calling methods on a certain UIViewController while another viewController is on the screen? -



iphone - Calling methods on a certain UIViewController while another viewController is on the screen? -

i have regular app bunch of view controllers - let's viewcontrollera, viewcontrollerb, , viewcontrollerweb.

"viewcontrollerweb" uiwebviewdelegate , has uiwebview in it. phone call methods on when interacting viewcontrollera or viewcontrollerb. (methods [webview stringbyevaluatingjavascriptfromstring:])

so essentially, seems want "viewcontrollerweb" open in background somehow. know how accomplish this? thinking wrong way?

hope guys can help me out! lot!

well, if want phone call these methods vc webviewcontroller created, making webviewcontroller global variable.

if want access outside vc, create webviewcontroller singleton can access anywhere within app. do:

static webviewcontroller *sharedcontroller = nil; + (webviewcontroller*)sharedcontroller { if(sharedcontroller == nil) sharedcontroller = [[webviewcontroller alloc] initwithnibname:@"webviewcontroller" bundle:[nsbundle mainbundle]]; homecoming sharedcontroller; }

that allow access webviewcontroller anywhere:

[[webviewcontroller sharedcontroller] stringbyevaluatingjavascript...]

edit: ryanr pointed out in comment, maintain view controller retained until explicitely release it. mutual error singletons forget them , never release them — create sure do!

iphone ios uiviewcontroller uiwebviewdelegate

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -