Hi,
I have in my first UIViewController an UISearchBar.
I want the value of the UISearchBar in my second UIViewController.
Here is the code of the second UIViewController:
firstViewController:
.h file
.m file
secondViewController:
.h file
.m file
I'm always get this error:
"request for member 'text' in something not a structure or union"
What should I do?
Thanks!
I have in my first UIViewController an UISearchBar.
I want the value of the UISearchBar in my second UIViewController.
Here is the code of the second UIViewController:
firstViewController:
.h file
Code:
UISearchBar *searchbar;
@property (nonatomic, retain) IBOutlet UISearchBar *searchBar;
.m file
Code:
@synthesize searchBar;
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {
[self dismissModalViewControllerAnimated:YES];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:
@"http://www.%@.com/", searchBar.text]]]];
}
secondViewController:
.h file
Code:
firstUIViewController *searchBar;
...
@property (nonatomic, retain) firstUIViewController * searchBar;
.m file
Code:
@synthesize searchBar;
- (void)viewDidLoad {
[super viewDidLoad];
NSString *urlAddress = [NSString stringWithFormat:@"http://www.%@.com/", searchBar.text];
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
}
I'm always get this error:
"request for member 'text' in something not a structure or union"
What should I do?
Thanks!