Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AreYouAMac

macrumors regular
Original poster
Jan 5, 2008
110
0
Hey guys!

When first making this practice app... I followed the AdvancedTableViewCell app and pushed the UILabels and UIImage onto a New VIew that would be shown once the user selected a cell.

The cell pushing the same information from an plist onto the New View when the user selects that cell.

Screenshot2010-11-19at71519PM.png
Screenshot2010-11-19at71620PM.png


Would it be possible to create a UIPageControl with 3 pages while still pushing the same UILabels and UIImages from the cell that was selected? Page 1 = UILabel "name", Page 2 = UILabel "publisher" Page 3 = UIImage "icon".

Here is the coding for the RootViewController.m at -didSelectRow...
Code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Get the dictionary of the selected data source.
NSDictionary *dataItem = [self.appetizer objectAtIndex:indexPath.row];
 
//Prepare to tableview.
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
 
//Set Icon
dvController.icon = [UIImage imageNamed:[dataItem objectForKey:@"Icon"]];
 
//Set Name
dvController.name = [dataItem objectForKey:@"Name"];
 
//Set Publisher
dvController.publisher = [dataItem objectForKey:@"Publisher"];
 
//Push the new table view on the stack
[self.navigationController pushViewController:dvController animated:YES];
 
[dvController release];
dvController = nil;
}

DetailViewController.h (which shows the New View)
Code:
@interface DetailViewController : UIViewController {
    IBOutlet UIImageView *iconView;
    IBOutlet UITextView *publisherLabel;
    IBOutlet UILabel *nameLabel;
 
    UIImage *icon;
    NSString *publisher;
    NSString *name;
}
 
@property (nonatomic, retain) UIImage *icon;
@property (nonatomic, retain) NSString *publisher;
@property (nonatomic, retain) NSString *name;
 
@end


And here is the coding that I have for the DetailViewController.m
Code:
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void) viewDidLoad {
    [super viewDidLoad];
 
iconView.image = icon;
nameLabel.text = name;
publisherLabel.text = publisher;
 
}

I'm just a little puzzled on how I would set up the UIPageControl. I am following the PageControl sample code and adding it onto the AdvancedTableViewCell sample code.

Would it be possible to just only stick with the 2 UIViewControllers I have right now (DetailView, RootView)? The RootView contains the cells, and the DetailView would be the PageControl.

Any helpful advice would be greatly appreciated.

Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.