views:

167

answers:

1

Hello, I have created Window based application, root controller as Tab Bar controller. One Tab bar has Navigation controller.

Navigation controller's ViewControlller implementation, I am pushing Viewcontroller.

I am looking to pass parameter from Navigation Controller's View controller to pushed View Controller.

I have tried to pass as per below method. //ViewController.h @interface ViewController:UIViewController{ NSString *String; } @property(copy, nonatomic)NSString *String; @end //ViewController.m #import "ViewController1.h"

ViewController1 *level1view = [[ViewController alloc]init]; level1view.hideBottomBarWhenPushed = YES; level1view.theString = String; [self.navigationController pushViewController:level1view animated:YES]; [level1view release];

//ViewController1.h NSString *theString;

@property(copy, nonatomic)NSString *theString;

This is working fine. but I want to pass more than one parameter like Integer and UITextFiled Values so how to do that?

Is there any Apple Doc that I can get idea about this?

Thanks,

A: 

you have to pass it one by one like this only but make sure that you pass it all after

[self.navigationController pushViewController:level1view animated:YES]; 

this line... Otherwise sometimes it won't reflect

So interchange

level1view.theString = String; 
[self.navigationController pushViewController:level1view animated:YES]; 

to

[self.navigationController pushViewController:level1view animated:YES]; 
level1view.theString = String;
mihirpmehta
thanks, Mihir,If I set interface method like -(void)loadData:(NSString)string in pushed view controller. Then I use that to pass Object values like [level1view loadData:String];Which is proper way to pass object values ?Thanks,[
TechFusion
It should also work...
mihirpmehta