A:
I'm pretty sure the URL to your file is:
Order Michigan Supreme Court
Lansing, Michigan
November 21, 2013 Robert P. Young, Jr.,
Chief Justice 01e38acffe
Русский язык (русский) и немецкий язык
Category:Drafting (preparation software)Q:
I am getting a variable in UINavigationController and I want to return the result in other ViewController (Trying to pass data)
I am getting a variable in UINavigationController and I want to return the result in other ViewController (Trying to pass data)
-(void)animationFinished:(NSString*)animationID finished:(BOOL)finished context:(void*)context
{
NSLog(@"%@",[animationID cStringUsingEncoding:NSUTF8StringEncoding]);
}
I want to pass the variable inside the above method to other ViewController, But I am getting null.
Here is my code snippet,
[webView stringByEvaluatingJavaScriptFromString:@"document.getElementsByClassName('category')[0].textContent"];
I am getting null in the above code,
Can you please help me in this,
A:
It looks like you are accessing the web view from your view controller. This will not work, you need to either send the information as a delegate message to your controller or create a delegate.
Here's a simple example:
Your View Controller:
@interface YourViewController: UIViewController
@property (nonatomic, weak) YourViewControllerDelegate *delegate;
@end
@protocol YourViewControllerDelegate
- (void)yourDelegateMethod:(NSString *)value;
@end
Your View Controller Implementation:
@implementation YourViewController
-(void)yourViewControllerMethod {
// Do something
}
- (void)viewDidLoad {
self.delegate = self;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.navigationController setDelegate:self];
Related links:
Comments