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

  • SEARCH
  • Home
  • 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 8745277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:58:51+00:00 2026-06-13T11:58:51+00:00

I’m creating my first app in iOS 5 using storyboards. I have a tableviewcontroller

  • 0

I’m creating my first app in iOS 5 using storyboards. I have a tableviewcontroller embedded in a navigation controller and when you click on the cells in the tableviewcontroller some detail about that cell topic & a URL should be passed to a detail view. I use a PList to populate the tableview. I failed to pass the detail to detail view…

Here is my code (4 classes):

//  NormalDataCell.m
#import "NormalDataCell.h"


@implementation NormalDataCell


@synthesize image = _image;
@synthesize nameLabel = _nameLabel;
@synthesize category = _category;
@synthesize webSiteURL = _webSiteURL;


@end

//  normalData.m
#import "NormalData.h"


@implementation NormalData


@synthesize name = _name;
@synthesize image = _image;
@synthesize webSiteURL = _webSiteURL;
@synthesize category = _category;


- (id)initWithItem:(NSDictionary *)item {

    self = [super init];
    if (self) {
        _name = [item objectForKey:@"name"];
        _image = [UIImage imageNamed:[item objectForKey:@"image"]];
        _webSiteURL = [item objectForKey:@"webSiteURL"];
        _category = [item objectForKey:@"category"];
    }
    return self;
}


@end


@implementation NormalCategory
@synthesize category = _category;
@synthesize normalList = _normalList;


- (id)initWithArray:(NSMutableArray *)normalList {

    self = [super init];
    if (self) {
        NSMutableArray *list = [[NSMutableArray alloc]init];
        for (NSDictionary *item in normalList) {
            NormalData *data = [[NormalData alloc]initWithItem:item];
            [list addObject:data];
        }

        NormalData *data = [list objectAtIndex:0];
        _category = data.category;
        _normalList = list;
    }
    return self;
}


@end

//  normalViewController.m

#import "NormalViewController.h"

#import "NormalData.h"

#import "NormalDataCell.h"

#import "NormalDetailView.h"



@interface NormalViewController ()

{

    @private

    NSMutableArray *_cellContentList;

}



@end



@implementation NormalViewController



@synthesize tableView; // Add this line of code

@synthesize roleArray;



- (void)viewDidLoad

{

    [super viewDidLoad];



    NSURL *url = [NSURL URLWithString:@"http://vfttx.web.fc2.com/normal.plist"];

    NSMutableArray *array = [NSMutableArray arrayWithContentsOfURL:url];



    _cellContentList = [[NSMutableArray alloc]init];

        for (NSMutableArray *item in array)

    {

        NormalCategory *category = [[NormalCategory alloc]initWithArray:item];

        [_cellContentList addObject:category];

    }

   }

//How do I pass the name & webSiteURL to DetailView?
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"TableToWebSegue"]) {

    NSIndexPath *path = [self.tableView indexPathForSelectedRow];
    NSString *cellName = [[_cellContentList objectAtIndex:path.row] objectForKey:@"name"];

    [segue.destinationViewController setDetailItem2:cellName];

        NSString *urlPath = [[_cellContentList objectAtIndex:path.row] objectForKey:@"webSiteURL"];

        [segue.destinationViewController setWebSiteURL:urlPath];

}
}


#pragma mark - Table view data source



- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{

    return [_cellContentList count];

}



- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {

    NormalCategory *category = [_cellContentList objectAtIndex:section];

    return [category category];

}





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

{

    NormalCategory *category = [_cellContentList objectAtIndex:section];

    return [category.normalList count];

}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    static NSString *CellIdentifier = @"normalDataCell";

    NormalDataCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];



    // Configure the cell...

    if (cell == nil) {

        cell = [[NormalDataCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    }



    NormalCategory *category = [_cellContentList objectAtIndex:[indexPath section]];

    NormalData *data = [category.normalList objectAtIndex:[indexPath row]];



    [cell.nameLabel setText:data.name];

    [cell.image setImage:data.image];

    cell.webSiteURL = data.webSiteURL;



    return cell;

}



@end

//  NormalDetailView.m
#import "NormalDetailView.h"


@interface NormalDetailView ()


@end


@implementation NormalDetailView


@synthesize webSiteURL;
@synthesize webView;
@synthesize name = _name;
@synthesize detailItem2;
@synthesize testNameLabel;


- (void)viewDidLoad
{
    [super viewDidLoad];

    testNameLabel.text = detailItem2;


//If the URL is right, it will work.
    NSString *strUrl = webSiteURL;
    strUrl = [strUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL URLWithString:strUrl];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [webView loadRequest:request];
}


@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-13T11:58:52+00:00Added an answer on June 13, 2026 at 11:58 am

    Presumably you’re using segues to move between the different views.

    Implement - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender on the view controller containing your table view and it will be called after the user taps the cell. It contains a reference to the segue object which you can use to find the sourceViewController and the destinationViewController, you can use these to set the data in the destination.

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

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have thousands of HTML files to process using Groovy/Java and I need to
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I

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.