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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:01:09+00:00 2026-06-14T05:01:09+00:00

i have two view controllers, GroupListViewController and GroupDetailViewController, switch back and forth, When switch

  • 0

i have two view controllers, GroupListViewController and GroupDetailViewController, switch back and forth, When switch forth by click the row cell,
Run with error, I do not have xib even. i do all component programmatically. search with the same question in here, it is not my type.

in code snippet below, “CustomGroupListViewCell *plcc” CustomGroupListViewCell is a custom UITableViewCell, you can implement a dump one with empty,

list the code here.

GroupListViewController.h

#import <UIKit/UIKit.h>


@class GroupDetailViewController;

@interface GroupListViewController : UITableViewController
{
    NSArray * contentArray;
    GroupDetailViewController * dvController;
}

@property (nonatomic, retain) GroupDetailViewController * dvController;

@end

GroupListViewController.m

#import "GroupListViewController.h"
#import "CustomGroupListViewCell.h"
#import "ZYAppDelegate.h"
#import "GroupDetailViewController.h"

@interface GroupListViewController ()
@end

@implementation GroupListViewController

@synthesize dvController;

- (void) viewDidLoad
{
contentArray = [[NSArray arrayWithObjects:@"heyun", @"wushi", @"ios", nil]retain];

[super viewDidLoad];

}


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    // Custom initialization
    }  
    return self;
}

- (void) dealloc
{
    [dvController release];
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear: animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear: animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear: animated];
}

- (void)viewDisDisappear:(BOOL)animated
{
    [super viewDidDisappear: animated];
}

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

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

    return [contentArray count];
}

// custom row height
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // dynamic with whether the cell has the gourp image or not..
    return 160;
}

// Customize the appearance of table view cells
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"PartyListCustomCell";

    CustomGroupListViewCell *plcc = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if(plcc == nil)
    {
        plcc = [[[CustomGroupListViewCell alloc] initWithStyle:UITableViewCellStyleDefault    reuseIdentifier:CellIdentifier] autorelease];
    }


    // set up custom cell
    plcc.gourpTitle.text = @"gourpTitle";


    return plcc;

 }

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

    if (dvController == nil)
    {
        GroupDetailViewController *aController = [[GroupDetailViewController alloc] initWithNibName:@"GroupDetailViewController" bundle:nil];

        self.dvController = aController;

        [aController release];
    }

    [dvController updateRowNumber:indexPath.row];
    [[self navigationController] pushViewController:dvController animated:YES];    

}

@end

GroupDetailViewController.h

#import <UIKit/UIKit.h>

@interface GroupDetailViewController : UITableViewController
{
    int rowNumber;    
}

@property(readwrite) int rowNumber;
- (void) updateRowNumber:(int) theindex;

@end

GroupDetailViewController.m

#import "GroupDetailViewController.h"

@interface GroupDetailViewController ()

@end

@implementation GroupDetailViewController

@synthesize rowNumber;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self)
    {
        // Custom initialization
    }
    return self;
}

- (void) updateRowNumber: (int) theindex
{

    rowNumber = theindex + 1;

    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(50.0, 20.0, 200.0, 50.0)];

    label1.text = [NSString stringWithFormat:@"row %i was clicked ", rowNumber];
    [self.view addSubview: label1];
    [label1 release];

}

- (void)dealloc
{

    [super dealloc];
}

- (void)viewDidLoad
{

    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(50.0, 20.0, 200.0, 50.0)];

    label1.text = [NSString stringWithFormat:@"row %i was clicked ", rowNumber];

    [self.view addSubview: label1];


    [super viewDidLoad];
    [label1 release];
    // Do any additional setup after loading the view from its nib.
 }

 - (void)fetchedData: (NSData *)responseData
{
    // parse out the json data
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewWillAppear:(BOOL)animated
{
     [super viewWillAppear: animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear: animated];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@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-14T05:01:10+00:00Added an answer on June 14, 2026 at 5:01 am

    When initializing your view controller by calling

    [[GroupDetailViewController alloc] initWithNibName:@"GroupDetailViewController" bundle:nil];
    

    we are expecting you to provide the corresponding xib (“GroupDetailViewController”). If you don’t want to use a xib, just call

    [[GroupDetailViewController alloc] init]
    

    and implement loadView in your GroupDetailViewController class.

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

Sidebar

Related Questions

i have two view controllers, FirstViewController and DetailViewController, switch back and forth. in didSelectRowAtIndexPath
I have two view controllers in a tabbar which can both edit data. Therefore,
I have two view controllers that allow changes to the Address Book. The first
I have two view controllers name RootViewController and SecondViewController. In the FirstViewController I have
I have two view Controllers in my project ViewController , SettingsView . Here I
I have application where i have two view controllers my first view and second
Currently using Xcode 4.2 and I have two view controllers (1 and 2). I
I have an app with two view controllers. ViewControllerA is a blank view with
I have a partial view that is shared between two controllers and I'm trying
I have two view Controllers added as a sub-view in the UIWindow. Now the

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.