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 8525227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:54:57+00:00 2026-06-11T07:54:57+00:00

I currently have developed a Tabbed Based Application. The first Tab is decors which

  • 0

I currently have developed a Tabbed Based Application. The first Tab is decors which displays Colour Swatches or Images in a TableView Structure. Currently when you push on a image or Colour swatch An alert pops up saying which table cell you have pushed. I instead want to link each table cell image or Colour swatch to a new view controller showing a bigger image of that image or colour swatch. A modal would also do fine

enter image description here

enter image description here

#import "TableViewsViewController.h"

@implementation TableViewsViewController

#pragma mark -
#pragma mark Synthesizers

@synthesize table;
@synthesize sitesArray;
@synthesize imagesArray;

#pragma mark -
#pragma mark View lifecycle

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {


// Load up the sitesArray with a dummy array : sites
NSArray *sites = [[NSArray alloc] initWithObjects:@"a", @"b", @"c", @"d", @"e", @"f", @"g", @"h", nil];
self.sitesArray = sites;
[sites release];

UIImage *active = [UIImage imageNamed:@"a.png"];
UIImage *ae = [UIImage imageNamed:@"b.png"];
UIImage *audio = [UIImage imageNamed:@"c.png"];
UIImage *mobile = [UIImage imageNamed:@"d.png"];
UIImage *net = [UIImage imageNamed:@"e.png"];
UIImage *photo = [UIImage imageNamed:@"f.png"];
UIImage *psd = [UIImage imageNamed:@"g.png"];
UIImage *vector = [UIImage imageNamed:@"h.png"];

NSArray *images = [[NSArray alloc] initWithObjects: active, ae, audio, mobile, net, photo, psd, vector, nil];
self.imagesArray = images;
[images release];

[super viewDidLoad];
}


#pragma mark -
#pragma mark Table View datasource methods

// Required Methods

// Return the number of rows in a section
-(NSInteger) tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section
{
return [sitesArray count];
}

// Returns cell to render for each row
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellIdentifier";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}

// Configure cell

NSUInteger row = [indexPath row];

// Sets the text for the cell
//cell.textLabel.text = [sitesArray objectAtIndex:row];

// Sets the imageview for the cell
cell.imageView.image = [imagesArray objectAtIndex:row];

// Sets the accessory for the cell
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

// Sets the detailtext for the cell (subtitle)
//cell.detailTextLabel.text = [NSString stringWithFormat:@"This is row: %i", row + 1];

return cell;
}

// Optional

// Returns the number of section in a table view
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}

#pragma mark -
#pragma mark Table View delegate methods

// Return the height for each cell
-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 78;
}

// Sets the title for header in the tableview
-(NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return @"Decors";
}

// Sets the title for footer
-(NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
return @"Decors";
}

// Sets the indentation for rows
-(NSInteger) tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
 {
return 0;
}

// This method is run when the user taps the row in the tableview
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Tapped row!" 
                                          message:[NSString stringWithFormat:@"You tapped: %@", [sitesArray objectAtIndex:indexPath.row]]
                                          delegate:nil 
                                          cancelButtonTitle:@"Yes, I did!" 
                                          otherButtonTitles:nil];
[alert show];
[alert release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}

#pragma mark -
#pragma mark Memory management

- (void)didReceiveMemoryWarning {
NSLog(@"Memory Warning!");
[super didReceiveMemoryWarning];
}

- (void)viewDidUnload {
self.table = nil;
self.sitesArray = nil;
self.imagesArray = nil;
[super viewDidUnload];
}


- (void)dealloc {
[table release];
[sitesArray release];
[imagesArray release];
[super dealloc];
}

@end

Part where the Alert is

// This method is run when the user taps the row in the tableview
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Tapped row!" 
                                          message:[NSString stringWithFormat:@"You tapped: %@", [sitesArray objectAtIndex:indexPath.row]]
                                          delegate:nil 
                                          cancelButtonTitle:@"Yes, I did!" 
                                          otherButtonTitles:nil];
[alert show];
[alert release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
  • 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-11T07:54:59+00:00Added an answer on June 11, 2026 at 7:54 am

    In didSelectRowAtIndexPath you can just init another view controller and present. You can present it from self.navigationController so that there is a back button if you wish. Here I show it presented modally:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
        // Deselect row
        [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
        // Declare the view controller
        UIViewController *anotherVC = nil;
    
        // Determine the row/section on the tapped cell
        switch (indexPath.section) {
            case 0:
                switch (indexPath.row) {
                    case 0: {
                        // initialize and allocate a specific view controller for section 0 row 0
                        anotherVC = [[ViewControllerForRowZeroSectionZero alloc] init];
                        break;
                    }
                    case 1: {
                        // initialize and allocate a specific view controller for section 0 row 1
                        anotherVC = [[ViewControllerForRowOneSectionZero alloc] init];
                        break;
                    }
                }
                break;
            case 1: {
                // initialize and allocate a specific view controller for section 1 ALL rows
                anotherVC = [[ViewControllerForAllRowsSectionOne alloc] init];
                break;
            }
        }
    
        // Get cell textLabel string to use in new view controller title
        NSString *cellTitleText = [[[tableView cellForRowAtIndexPath:indexPath] textLabel] text];
    
        // Get object at the tapped cell index from table data source array to display in title
        id tappedObj = [sitesArray objectAtIndex:indexPath.row];
    
        // Set title indicating what row/section was tapped
        [anotherVC setTitle:[NSString stringWithFormat:@"You tapped section: %d - row: %d - Cell Text: %@ - Sites: %@", indexPath.section, indexPath.row, cellTitleText, tappedObj]];
    
        // present it modally (not necessary, but sometimes looks better then pushing it onto the stack - depending on your App)
        [anotherVC setModalPresentationStyle:UIModalPresentationFormSheet];
    
        // Have the transition do a horizontal flip - my personal fav
        [anotherVC setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
    
        // The method `presentModalViewController:animated:` is depreciated in iOS 6 so use `presentViewController:animated:completion:` instead.
        [self.navigationController presentViewController:anotherVC animated:YES completion:NULL];
    
        // We are done with the view controller.  It is retained by self.navigationController so we can release it (if not using ARC)
        [anotherVC release], anotherVC = nil;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a form based login in my application which is developed on
Currently we have developed application using Java 6 based on windows 32bit(Dual core &
I wanted to develop a small web based chat application. Currently I have developed
I have developed a few Delphi Win32 (currently using D2007) applications, which revolve around
I have to reuse a major C++ project which is currently developed inside eclipse,
We currently have a fully developed web forms application, basically its like WordPress using
I have developed a grails application that stores a great deal of information. Currently,
I have developed an iPad app which is currently in the testing phase. I
We currently have developed an application using WCF. Our clients make connections to different
I have developed one window application which requires one report to be print. This

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.