I have large images displayed in a grouped tableview. I would like the images to fill the entire width of the screen. I have been able to make this work using a tableViewCell interface builder, but in an attempt to improve performance I am now trying to do this programmatically.
However, I have not been able to get the image to be flush against the left side of the screen. It seems to be using the default position of the cells in the grouped tableview.
I was able to make it work using a plain tableview, but then the section headers anchor on the top of the screen and I need them to scroll.
Any ideas how to do this programmatically? Here's my original code below. Thanks!
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyTableViewCellIdentifier = @"Cell";
MyTableViewCell *cell = (MyTableViewCell *)
[tableView dequeueReusableCellWithIdentifier: MyTableViewCellIdentifier];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MyTableViewCell" owner:self options:nil];
for(id currentObject in nib)
{
cell = (DetailTableViewCell *)currentObject;
}
MyAppAppDelegate *appDelegate = (MyTableViewCell *)[[UIApplication sharedApplication] delegate];
NSString *Path = [[NSBundle mainBundle] bundlePath];
NSString *MainImagePath = [Path stringByAppendingPathComponent:
([[appDelegate.myDictionaryOfImages objectAtIndex:indexPath.section] objectForKey:@"LargeImage"])];
cell.myLargeImage.image = [UIImage imageWithContentsOfFile:MainImagePath];
return cell;
}