Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All.
I have just study Object C iPhone for a week.But I not yet how to use a variable from another class. Ex: I have 2 class RootViewControllor.h and BooksViewControllor.m
at RootViewControllor.h was declared as below:
@interface RootViewControllor : IUTableViewControllor{
NSArray *authorList;
}

@property (retain) NSArray *authorList;
@end

Now I want to at BooksViewControllor.m I can use variable authorList t to get or set value to it, that mean is authorList can be used both RootViewControllor.m and BooksViewControllor.m


Please help me this problem!

Thanks in advance.
Posted

1 solution

1) You need to synthesize the variable in RootViewControllor.m file

@synthesize authorList;


2) and u have to implement the RootViewControllor.h in BooksViewControllor.m


3) Now you can access the authorList in BooksViewControllor.m using RootViewControllor object.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900