Reputation: 825
Leveraging RESideMenu
https://github.com/romaonthego/RESideMenu in my app, now has an issue of passing some urlString
related to lists in sideMenuViewControll
to show its web page in right UIWebView
.
Original codes like below:
case 2: {
navigationController.viewControllers = @[[self.storyboard instantiateViewControllerWithIdentifier:@"second"]];
[self.sideMenuViewController hideMenuViewController];
}
break;
"second"
is for secondViewController
that has a UIWebView
for showing web page at right side. secondViewController
has a property: urlString
.
My intention is to show its web page when selecting "Profile". Tried several way, however, I can't find one to set urlString
after navigationController.viewControllers = @[[self.storyboard instantiateViewControllerWithIdentifier:@"second"]];
How can I set and pass urlString
so that it could be used like NSUrl * url = [NSURL URLWithString:urlString]
?
Upvotes: 0
Views: 1036
Reputation: 825
After tried every method I could get, find a workaround by using [navigationController.viewControllers[0] setTitle:urlStrings]
might works.
Is doing such correctly?
Upvotes: 0
Reputation: 1214
First of all import your secondViewController in your first View Controller's .m file
Create in secondViewController's .h file
@property (strong, nonatomic) *NSString passedURL;
Then give the storyboard name in Attribute Inspector. Now, on button event of profile or whatever
secondViewController *svc = [self.storyboard instantiateViewControllerWithIdentifier:@"secondViewController"];
svc.passedURL = urlString;
[self presentViewController:svc animated:YES completion:nil];
Thats it. Hope that it works for you.
Upvotes: 1
Reputation: 3273
The Below line shows that,
navigationController.viewControllers = @[[self.storyboard instantiateViewControllerWithIdentifier:@"second"]];
You are trying to access the array of ViewControllers, but I am not sure why you want all the ViewControllers. I think you can get the secondViewController like this below and set the string
secondViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"secondViewController"];
secondViewController.urlString = urlString;
Upvotes: 0