I am implementing FB kind of functionality where I
- populate a list of menu from database on left side.
- clicking any of menu loads a related web page inside webview.
Both Menu’s and Webview are in different viewcontroller
When menu gets clicked, I send notification message to first viewcontroller and inside notification message I write code to loadRequest.
However this is not working. I am able to loadRequest successfully from first Viewcontroller.however it is not possible to do from another viewcontroller.
here is my code:
ViewController 1:
in ViewLoad
NSNotificationCenter *note = [NSNotificationCenter defaultCenter];
[note addObserver:self selector:@selector(eventDidFire:) name:@"ILikeTurtlesEvent" object:nil];
- (void) eventDidFire:(NSNotification *)note {
web.delegate=self;
[web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]];
}
in ViewController 2:
NSNotificationCenter *note = [NSNotificationCenter defaultCenter];
[note postNotificationName:@"ILikeTurtlesEvent" object:self];
This could be the another option for what you are trying to do: