Basically you will need two things:
- Get the string from user
As you've already known, all you need to do is to set your IBOutlet on your textfield and read the string.
- Pass it to another view controller
You have two options to do it:
First, you can add a string to your second view controller and set it property. Then create a custom -init to receive the url string. In your first view controller, when you create the second view controller(I assume that's the case), use your custom -init to set the value.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil andURL:(NSString *) url
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
self.urlString = url;
}
return self;
}
You have another option: create a method on the second view controller.
so in your second view controller, do this:
-(void) setURL: (NSString *) url
{
self.rulString = url;
}
and in your first view controller, do:
SecondViewController *secondVC = [SecondViewController alloc] init];
// get url string from user input and store it in a local string variable named tempURL
[secondVC setURL:tempURL];
Hope this helps.