I'm trying to access an NSMutableArray which is a data member of my AppDelegate class. It is synthesized in the implementation, and is an array of a custom class which has a "name" NSString data member.
I currently use it to fill a Table View (a SubView) like this:
cell.textLabel.text = [[[delegate contentArray] objectAtIndex:indexPath.row] name];
This works, but I get a warning:
warning: no '-contentArray' method found
It won't compile as:
cell.textLabel.text = [[delegate.contentArray objectAtIndex:indexPath.row] name];
I get this in that case:
error: request for member 'contentArray' in something not a structure or union
What is the proper way to access an array in the delegate?
Update:
To declare delegate
, in the table view controller header file, I include @class MainAppDelegate;
and in the @interface
I declare a data member MainAppDelegate *delegate;
. In the table view controller's @implementation
I do @synthesize delegate;
.