Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AbhishekApple

macrumors member
Original poster
Aug 5, 2010
86
0
i have loaded a View with dynamic content on click of tabbar button but when it loads for the first time it doesn't displays any data but when i do the process 2nd time, it start showing the details.

Do i have to reload the view some were for the first time???

Parent.m
Code:
-(void)btnClick:(id)sender{
if(childController == nil)
  childController = [[ChildController alloc] initWithNibName:@"ProductCompare" bundle:[NSBundle mainBundle]];

if(navController == nil)
			navController = [[UINavigationController alloc] initWithRootViewController:childController];
[self.navigationController presentModalViewController:navController animated:YES];
		
		[childController setProductText:@"asdf"];
		[childController setPriceText:@"erte"];
}

ChildController.m

Code:
- (void)viewDidLoad {
   [super viewDidLoad];
	if(isViewPushed == NO) {
		self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] 											  initWithBarButtonSystemItem:UIBarButtonSystemItemCancel 
												  target:self action:@selector(cancel_Clicked:)] autorelease];
	}
}

-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}


-(void) cancel_Clicked:(id)sender {
	[self.navigationController dismissModalViewControllerAnimated:YES];
}

- (void) setProductText:(NSString *)_str{
	lblProduct.text = _str;
}

- (void) setPriceText:(NSString *)_str{
	lblPrice.text = pstr;
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.