Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7850435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:51:00+00:00 2026-06-02T18:51:00+00:00

Hi I’m trying to push to a different view depending what a user selects.

  • 0

Hi I’m trying to push to a different view depending what a user selects. I have a table view with 4 other view controllers linked to it via push segues in the story board. All Segues are linked directly to the TableView view controller. Depending on what cell is selected, it loads the corresponding view. Heres the code I’m using:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{


    NSDictionary *dictionary = [_articles objectAtIndex:indexPath.row];
    NSArray *selectedKey = [dictionary objectForKey:@"Key"];


    if ([selectedKey isEqual:@"Driver"]){

        self.driverDetailView.wikiItem = dictionary;
        [self.driverDetailView performSegueWithIdentifier:@"pushDriver" sender:dictionary];
        NSLog(@"Push Driver");
    }

    if ([selectedKey isEqual:@"Team"]) {
        NSLog(@"Push Team");
    }
}


-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    NSLog(@"Preparing For Segue");
    if ([[segue identifier] isEqual:@"pushDriver"]) {
        self.driverDetailView=segue.destinationViewController;
    }

}

For some reason

 [self.driverDetailView performSegueWithIdentifier:@"pushDriver" sender:dictionary];
 NSLog(@"Push Driver");

won’t allow me to set as “Self” at the beginning, i get a error saying:

No Visible @interface for TableCell declares the selector
performSegueWithIdentifier

If i use “self.driverDetailView” i don’t get a error, but when i select the cell nothing happens.

Heres the HorizontalTableView.h

#import <UIKit/UIKit.h>
#import "HorizontalDetailView.h"
#import "HorizontalTableCell.h"
@interface HorizontalTableView : UITableViewController <UITableViewDelegate,   UITableViewDataSource> {

NSDictionary *_articleDictionary;
NSMutableArray *_reusableCells;

}

@property (nonatomic, retain) NSDictionary *articleDictionary;
@property (nonatomic, retain) NSMutableArray *reusableCells;


@end

Heres the HorizontalTableView.m

#import "HorizontalTableView.h"
#import "HorizontalTableCell.h"
#import "ControlVariables.h"
#import "HorizontalDetailView.h"

#define kHeadlineSectionHeight  26
#define kRegularSectionHeight   18

@interface HorizontalTableView ()

@end

@implementation HorizontalTableView
@synthesize articleDictionary = _articleDictionary;
@synthesize reusableCells = _reusableCells;



- (void)awakeFromNib{
    [self.tableView setBackgroundColor:kVerticalTableBackgroundColor];
    self.tableView.rowHeight = kCellHeight + (kRowVerticalPadding * 0.5) + ((kRowVerticalPadding * 0.5) * 0.5);
}

- (id)initWithStyle:(UITableViewStyle)style{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad{
    [super viewDidLoad];

    self.articleDictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Data" ofType:@"plist"]];
}

- (void)viewDidUnload{
    [super viewDidUnload];

    self.articleDictionary = nil;
    self.reusableCells = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:     (UIInterfaceOrientation)interfaceOrientation{

    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}



- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return [self.articleDictionary.allKeys count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"HorizontalCell";

    HorizontalTableCell *cell = (HorizontalTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil){
        cell = [[HorizontalTableCell alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, tableView.frame.size.height)];
    }

    NSSortDescriptor* sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
    NSArray* sortedCategories = [self.articleDictionary.allKeys sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];

    NSString *categoryName = [sortedCategories objectAtIndex:indexPath.section];

    NSArray *currentCategory = [self.articleDictionary objectForKey:categoryName];

    cell.articles = currentCategory;

    return cell;
}


- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{

    return section == 0 ? kHeadlineSectionHeight : kRegularSectionHeight;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

    UIView *customSectionHeaderView;
    UILabel *titleLabel;
    UIFont *labelFont;

    if (section == 0)
    {
        customSectionHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, kHeadlineSectionHeight)];

        titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, tableView.frame.size.width, kHeadlineSectionHeight)];
        labelFont = [UIFont boldSystemFontOfSize:20];
    }
    else
    {
        customSectionHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, kRegularSectionHeight)];

        titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, tableView.frame.size.width, kRegularSectionHeight)];

        labelFont = [UIFont boldSystemFontOfSize:14];
    }

    customSectionHeaderView.backgroundColor = [UIColor colorWithRed:0.01176471 green:0.01176471 blue:0.01960784 alpha:0.95];

    titleLabel.textAlignment = UITextAlignmentLeft;
    [titleLabel setTextColor:[UIColor whiteColor]];
    [titleLabel setBackgroundColor:[UIColor clearColor]];
    titleLabel.font = labelFont;

    NSSortDescriptor* sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
    NSArray* sortedCategories = [self.articleDictionary.allKeys sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];

    NSString *categoryName = [sortedCategories objectAtIndex:section];

    titleLabel.text = [categoryName substringFromIndex:1];

    [customSectionHeaderView addSubview:titleLabel];


    return customSectionHeaderView;
}

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    NSLog(@"Preparing For Segue");
}

@end

The Code for HorizontalTableCell.h is:

#import <UIKit/UIKit.h>
#import "HorizontalDetailView.h"
#import "DriverDetailView.h"
#import "HorizontalTableView.h"
@interface HorizontalTableCell : UITableViewCell <UITableViewDelegate, UITableViewDataSource> {

    UITableView *_horizontalTableView;
    NSMutableArray *_articles;
    HorizontalTableCell *horizontalTableCell;

}


@property (nonatomic, strong) UITableView *horizontalTableView;
@property (nonatomic, strong) NSMutableArray *articles;
@property (nonatomic, strong) HorizontalDetailView *horizontalDetailView;
@property (nonatomic, strong) DriverDetailView *driverDetailView;
@property (nonatomic, strong) HorizontalTableCell *horizontalTableCell;
@end

The code for HorizontalTableCell.m is:

#import "HorizontalTableCell.h"
#import "ControlVariables.h"
#import "ArticleCell.h"
#import "HorizontalDetailView.h"
@implementation HorizontalTableCell

@synthesize horizontalTableView = _horizontalTableView;
@synthesize articles = _articles;
@synthesize horizontalDetailView;
@synthesize driverDetailView;
@synthesize horizontalTableCell;

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [self.articles count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifier = @"Cell";

    ArticleCell *cell = (ArticleCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil){
        cell = [[ArticleCell alloc] initWithFrame:CGRectMake(0, 0, kCellWidth, kCellHeight)];
    }

    NSDictionary *currentArticle = [self.articles objectAtIndex:indexPath.row];

    cell.thumbnail.image = [UIImage imageNamed:[currentArticle objectForKey:@"Image"]];
    cell.titleLabel.text = [currentArticle objectForKey:@"Title"];

    return cell;
}

- (void)dealloc{
    self.horizontalTableView = nil;
    self.articles = nil;
}

- (NSString *) reuseIdentifier{
    return @"HorizontalCell";
}

- (id)initWithFrame:(CGRect)frame{
    if ((self = [super initWithFrame:frame])){
        self.horizontalTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kCellHeight, kTableLength)];
        self.horizontalTableView.showsVerticalScrollIndicator = NO;
        self.horizontalTableView.showsHorizontalScrollIndicator = NO;
        self.horizontalTableView.transform = CGAffineTransformMakeRotation(-M_PI * 0.5);
        [self.horizontalTableView setFrame:CGRectMake(kRowHorizontalPadding * 0.5, kRowVerticalPadding *
                                                      0.5, kTableLength - kRowHorizontalPadding, kCellHeight)];

        self.horizontalTableView.rowHeight = kCellWidth;
        self.horizontalTableView.backgroundColor = kHorizontalTableBackgroundColor;

        self.horizontalTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
        self.horizontalTableView.separatorColor = [UIColor clearColor];

        self.horizontalTableView.dataSource = self;
        self.horizontalTableView.delegate = self;
        [self addSubview:self.horizontalTableView];
    }

    return self;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    NSDictionary *dictionary = [_articles objectAtIndex:indexPath.row];
    NSArray *selectedKey = [dictionary objectForKey:@"Key"];
    // NSLog(@"Selected Key = %@",selectedKey);

    if ([selectedKey isEqual:@"Driver"]){

        self.driverDetailView.wikiItem = dictionary;
        [self performSegueWithIdentifier:@"pushDriver" sender:self];
        NSLog(@"Push Driver");
    }

    if ([selectedKey isEqual:@"Team"]) {
        NSLog(@"Push Team");
    }

    if ([selectedKey isEqual:@"Tech"]) {
        NSLog(@"Push Tech");
    }

    if ([selectedKey isEqual:@"Track"]) {
        NSLog(@"Push Track");
    }

    //self.horizontalDetailView.wikiItem = dictionary;

    // NSLog(@"selected Array = %@",dictionary);

}


-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    NSLog(@"Preparing For Segue");
    if ([[segue identifier] isEqual:@"pushDriver"]) {
        self.driverDetailView=segue.destinationViewController;
    }
}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:51:02+00:00Added an answer on June 2, 2026 at 6:51 pm

    If I understand you correctly, you have your segues hooked up to table view cells. If that’s right, I would suggest hooking them from the view controller itself to the destination view controllers and then calling [self performSegueWithIdentifier:@"pushDriver"]; in your didSelectRowAtIndexPath: method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I am trying to loop through a bunch of documents I have to put
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.