i am using UITabBar to display two viewControllers, firstViewController is a uiview and secondViewController is a table view. what my need is when i clicked the second view table cell, the value should be updated on UILabel of firstViewController.
my code is here,
In secondviewcontroller.h
@interface firstviewcontroller {
NSMutableArray *stationnamestobepassed;
}
@property (nonatomic, retain) NSMutableArray *stationnamestobepassed;
@end
In secondviewcontroller.m
declare this
@implementation firstviewcontroller
@synthesize stationnamestobepassed;
-(void) someaction{
stationnamestobepassed = [NSMutableArray
arrayWithObjects:@"string1",@"string2",@"string3"];
secondviewcontroller = [[secondviewcontroller alloc]initWithNibName:@"NIbName"
Bundle:nil];
secondviewcontroller.stationnamespassed = self.stationnamestobepassed;
//i am not pushing the view controller.
}
@end
In firstviewcontroller.h
declare this
@interface secondviewcontroller {
NSMutableArray *stationnamespassed;
}
@property (nonatomic, retain) NSMutableArray *stationnamespassed;
@end
In firstviewcontroller.m
declare this
@implementation secondviewcontroller
@synthesize stationnamespassed;
-(void)viewWillAppear:(BOOL)animated
{
//stationNameDisplay is a uilabel
stationNameDisplay.text=[stationnamespassed objectAtIndex:0];
NSLog(@"station name %@",[stationnamespassed objectAtIndex:0]);
}
-(void) dealloc{
[stationnamespassed release];
[super release];
}
@end
problem is , value is not updating and it gives NULL. but i tried with pushing the first vie and it works. actually i don't want to push that view controller because i was already exist on tab.