jeudi 23 mars 2017

If Else Statement not working

So I am trying to pass information between view controllers. The first view controller has a textfield where the user can enter a username (student's name). I pass the student's name to the second view controller (named url). In the second view controller, I use an if statement to match the student's name to the correct url. Example: (OBJECTIVE C)

 if ([self.url isEqualToString:@"James"]) {    // 1st Student
    self.link = @"https://example.com";


} else if ([self.url isEqualToString:@"Taylor"]) {           // 2nd Student
    self.link = @"http://ift.tt/2oa8ODS";

And then I use the NSString Link and place it here:

 NSURL *urls = [NSURL URLWithString:[self.link
  stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];

But it doesn't work. The web view is empty. How do I fix this?

Aucun commentaire:

Enregistrer un commentaire