i have 2 classes in my app. View1 & View2; i want to use an object like array, strin, label.text in another class when i used them the shows null ;
View1.h:
{
NSMutableArray *array;
IBOutlet UILabel *lbl;
NSString *str;
}
@property(nonatomic,retain) NSMutableArray *array;
@property(nonatomic,retain)IBOutlet UILabel *lbl;
@property(nonatomic,retain) NSString *str;
@end;
View1.m
@synthesize array;
@synthesize lbl;
@synthesize str;
array = (1,2,3,..., nil) some dataa
str = @"HAI";
lbl.text = @"Text in label aaaa";
NSLog( @" %@", array );
NSLog( @" %@", lbl.text );
NSLog( @" %@", str );
gives correct out put
but in View2:
@implementation View2
#import "View1"
.
..
....
View1 *one = [View1 alloc]initwit.....................];
NSLog( @" %@", one.array );
NSLog( @" %@", one.lbl.text );
NSLog( @" %@", one.str );
prints null value
why ? what to do?
thanks in advance..
initmethod has the code assigning values toarrayetc? looks like View2 is calling a different initializer.