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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:49:47+00:00 2026-06-01T15:49:47+00:00

I have a table view with a lot of items when i click on

  • 0

I have a table view with a lot of items
when i click on a cell in the table it loads a view with a web view outlet, in the web view in viewdidload i have this line of code to load the html file wich is in the project file

NSString *name = pagename.text;
[WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:name ofType:@"html"]isDirectory:NO]]];

the code to push from the selected cell to that web view with is called Test is

if (indexPath.row == 0) 
{

    Test *test = [[Test alloc] initWithNibName:nil bundle:nil];
    test.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:test animated:YES];

    NSString *name1 = @"ba";
    [[test pagename] setText:[NSString stringWithString:(NSString *)name1]];

}

else if (indexPath.row == 1) 
{

    Test *test = [[Test alloc] initWithNibName:nil bundle:nil];
    test.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:test animated:YES];

    NSString *name1 = @"bb";
    [[test pagename] setText:[NSString stringWithString:(NSString *)name1]];

}

else if (indexPath.row == 2) 
{

    Test *test = [[Test alloc] initWithNibName:nil bundle:nil];
    test.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentModalViewController:test animated:YES];

    NSString *name1 = @"bc";
    [[test pagename] setText:[NSString stringWithString:(NSString *)name1]];

}

the html files are called ba,bb,bc and bd .html

the problem is when i select any cell of the four cells i have in the table it shows the same html file “ba.html”

i tried everything , cleaning the project, deleting the files and copying them back, changed the simulator, restarted the lap and even changed the files names.

any help ?

thanks in advance

update :

This is the hole code

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

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


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

    static NSString *CellIdentifier = @"CustomCell";


    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    [[cell textLabel] setTextAlignment:UITextAlignmentRight];

    cell.textLabel.text = [array objectAtIndex:indexPath.row];
    cell.textLabel.font = [UIFont systemFontOfSize:18];
    cell.textLabel.numberOfLines = 3;

    return cell;
}

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

    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    if (indexPath.row == 0) 
    {

        Test *test = [[Test alloc] initWithNibName:nil bundle:nil];
        test.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentModalViewController:test animated:YES];

        NSString *name1 = @"ba";
        [[test pagename] setText:name1];

    }

    else if (indexPath.row == 1) 
    {

        Test *test = [[Test alloc] initWithNibName:nil bundle:nil];
        test.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentModalViewController:test animated:YES];

        NSString *name1 = @"bb";
        [[test pagename] setText:name1];        
    }

    else if (indexPath.row == 2) 
    {

        Test *test = [[Test alloc] initWithNibName:nil bundle:nil];
        test.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentModalViewController:test animated:YES];

        NSString *name1 = @"bc";
        [[test pagename] setText:name1];
    }

    else if (indexPath.row == 3) 
    {

        Test *test = [[Test alloc] initWithNibName:nil bundle:nil];
        test.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentModalViewController:test animated:YES];

        NSString *name1 = @"bd";
        [[test pagename] setText:name1];

    }
}
  • 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-01T15:49:49+00:00Added an answer on June 1, 2026 at 3:49 pm

    You are presenting the controller before setting the page.

    Make ‘name’ an NSString instance variable in your webview class. Make it a property (nonatomic,retain) and synthesize it.

    Instead of setting the viewcontroller’s label, set name.
    Then in viewDidLoad, set the label from name.

    Set the label from the name, not the other way around.

    In the cell was selected:

    Test *test = [[Test alloc] initWithNibName:nil bundle:nil];
    test.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    NSString *name1 = @"bc";
    [test setName:[NSString stringWithString:(NSString *)name1]];
    [self presentModalViewController:test animated:YES];
    

    In the Web view viewdidload

    -(void)viewDidLoad {
        pagename.text = self.name;
        [WebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:name ofType:@"html"]isDirectory:NO]]];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table view of peoples names and when I click on one
I have a table view controller with (among others) a cell that is to
I have a table view with a custom cell ( UISwitch on every cell
I have been googling this issues since forever. I have a table view controller
I have custom table view cell with images (loaded from app document directory), labels,
Suppose I have a table view, and I want to implement something like this:
I have table View with grouped style with three sections. Get information from dictionary
I have a table view with numerous cells. When I press one, a tick
I have a table view. And I have multiple rows. While doing the reorder
I have a Table View Controller with cells. I want to update the text

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.