Reputation: 886
I've created a custom table where I can scroll through a list of items vertically, but I can also scroll left and right through those vertical index. How would I go about moving to a new view (in storyboards)?
Does anyone know how to programmatically add a segue from the custom cell to a new view?
Here's the code where I created the custom cell:
static NSString *CellIdentifier = @"ArticleCell";
__block ArticleCell_iPhone *cell = (ArticleCell_iPhone *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
Here's a screenshot of my custom table: http://i200.photobucket.com/albums/aa42/mininukinfuts/ScreenShot2012-05-24at145417.png
And here's a link to a tutorial I was following: http://www.raywenderlich.com/4723/how-to-make-an-interface-with-horizontal-tables-like-the-pulse-news-app-part-2
Upvotes: 1
Views: 1452
Reputation: 886
In order for me to fix this problem, I had to add the following code to my didSelectRowAtIndexPath method:
musicTime *MP = [self.sb instantiateViewControllerWithIdentifier:@"playMusic"];
[self.navCon pushViewController:MP animated:YES];
I gave my new view the identifier above, then in my .h I had:
@interface HorizontalTableCell_iPhone : HorizontalTableCell {
musicTime *Music;
UINavigationController *navCon;
UIStoryboard *sb;
}
@property (nonatomic, retain) musicTime *Music;
@property (nonatomic, retain) UINavigationController *navCon;
@property (nonatomic, retain) UIStoryboard *sb;
@end
Upvotes: 1
Reputation: 469
I assume you have a table view controller and subclass the table view cell.
If you subclass the table view cell you should only need to set up the segue directly from your table view and pass necessary variables.
After you assign the cell identifier and set the table view cell class, simply ctrl+drag from each table view cell to the next view and set the segue.
Upvotes: 0