Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to initialize value of another view controller
    primarykey
    data
    text
    <p>In my app when user redirect to app from browser I am presenting registration page. In that I want to insert value from url variable. So first I am fetching value from url and then displaying that page with textbox value.But it is not setting textbox value.</p> <p>my code:</p> <pre><code> - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { NSString *urlString=[NSString stringWithContentsOfURL:url encoding:nil error:nil]; NSRange r = [urlString rangeOfString:@"gratzeez://" options:NSCaseInsensitiveSearch]; if(r.location != NSNotFound){ NSLog(@"founddddd"); NSLog(@"gratzeez url %@",url); //NSString *str=[url valueForKey:@"email"]; NSArray *query = [[url query] componentsSeparatedByString:@"&amp;"]; NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithCapacity:[query count]]; for(NSString *parameter in query) { NSArray *kv = [parameter componentsSeparatedByString:@"="]; [parameters setObject:[kv count] &gt; 1 ? [[kv objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSISOLatin1StringEncoding] : [NSNull null] forKey:[[kv objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSISOLatin1StringEncoding]]; } NSLog(@"Parameters: %@", parameters); [self.tabBar dismissViewControllerAnimated:NO completion:nil]; RegistrationViewController *RegistrationVC=[[RegistrationViewController alloc] initWithNibName:@"RegistrationViewController" bundle:nil]; RegistrationVC.txtEmail.userInteractionEnabled=NO; NSLog(@"q = %@", [parameters objectForKey:@"email"]); UINavigationController *navController=[[UINavigationController alloc]initWithRootViewController:RegistrationVC]; RegistrationVC.txtEmail.text=[parameters objectForKey:@"email"]; NSLog(@"value%@",RegistrationVC.txtEmail.text); //here getting null value [self.tabBar presentViewController:navController animated:NO completion:nil]; navController.navigationItem.leftBarButtonItem=nil; return YES; } </code></pre> <p>what is I present registrationviewcontroller by this way.?</p> <pre><code>RegistrationViewController *RegistrationVC=[[RegistrationViewController alloc] init ]; NSLog(@"q = %@", [parameters objectForKey:@"email"]); UINavigationController *navController=[[UINavigationController alloc]initWithRootViewController:RegistrationVC]; NSLog(@"txtemail %@ value%@",RegistrationVC.txtEmail,RegistrationVC.txtEmail.text); [self.tabBar presentViewController:navController animated:NO completion:^{ RegistrationVC.txtEmail.userInteractionEnabled=NO; RegistrationVC.txtEmail.text=[parameters objectForKey:@"email"]; }]; </code></pre> <p>Now again this is giving null for both.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload