I have an array of images declared as such:
menuArray = [[NSMutableArray alloc] init];
[menuArray addObject:[UIImage imageNamed:@"one image.png"]];
[menuArray addObject:[UIImage imageNamed:@"another image.png"]];
[menuArray addObject:[UIImage imageNamed:@"and another.png"]];
[menuArray addObject:[UIImage imageNamed:@"and one more.png"]];
I've then determined the length of the table required like so:
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [menuArray count];
}
Ive built my custom prototype cell (containing only one UIImageView), set the identifier to "thiscell"
here is my .h file:
@interface RoadSafetyAppViewController : UIViewController <MFMailComposeViewControllerDelegate, UITableViewDelegate, UITableViewDataSource>{
IBOutlet UITableView *tableView;
NSMutableArray *menuArray;
}
@property (strong, nonatomic) IBOutlet UIImageView *backgroundImage;
@property (strong, nonatomic) UIApplication *application;
so I've started writing the method to place each image into the UIImageView in the custom Prototype Cell, as below:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: @"thiscell"];// warning here about local declaration of 'tableView' hides instance variable
//what do i put in here?
return cell;
}
What do i need to put in to get the images into the UIImageView? Also, there is a warning (indicated above) about local instance declaration - any suggestions on how to fix this?
Thanks in advance