• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Fwd: creating a UITableView on an "Utility application" project
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: creating a UITableView on an "Utility application" project


  • Subject: Fwd: creating a UITableView on an "Utility application" project
  • From: Alejandro Aragón <email@hidden>
  • Date: Sun, 16 May 2010 17:06:23 -0500

Hi everyone,

I'm new to iPhone development and I'm really stuck at this point. I
apologize for the lengthy email, but I wanted to provide all the relevant
code. I've been trying to add a UITableView to an existing Utility
Application programmatically. In order to add the UITableView to the flip
side, I basically changed the interface definition of the
FlipSideViewController so that class is also the data source and the
delegate of the table view:

@interface FlipsideViewController : UIViewController <UITableViewDelegate,
UITableViewDataSource> {
...


Then, in the viewDidLoad method, I added the UITableView programmatically:

@implementation FlipsideViewController
...

- (void)viewDidLoad {



    [super viewDidLoad];

 // create table view
UITableView *unitTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,
40, 320, 320) style:UITableViewStyleGrouped];


    unitTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|
UIViewAutoresizingFlexibleWidth;
    unitTableView.delegate = self;
    unitTableView.dataSource = self;


    [unitTableView reloadData];


    [self.view addSubview:unitTableView];
    [unitTableView release];
}


Up to this point everything goes fine, the table view shows up but it has no
functionality. Now the problem that I'm facing:
I want each one of the rows in the table view to display some additional
information, so I created a detail view so that the application transitions
to it when a user clicks on a row. I then created a DetailView.xib, and a
DetailViewController.

@interface DetailViewController : UIViewController {

int row;
IBOutlet UILabel *message;


}

@property (readwrite) int row;
@property (nonatomic, retain) IBOutlet UILabel *message;

@end


@implementation DetailViewController

@synthesize row;
@synthesize message;


 // The designated initializer.  Override if you create the controller
programmatically and want to perform customization that is not appropriate
for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle*)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
{
    }

   return self;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}

- (void)viewDidUnload {
    [super viewDidUnload];
}


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


@end


In the interface builder, I assigned the DetailViewController class to the
view. Now, in the FlipsideViewController class, I added the function that is
supposed to handle the action when the user clicks on a row:

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


if (dvController == nil) {

DetailViewController *aController = [[DetailViewController alloc]
initWithNibName:@"DetailView" bundle:nil];

self.dvController = aController; :

[aController release];

}

[self.navigationController pushViewController:dvController animatedYES];
}


When I run the application, nothing happens when the user clicks on the row
of a table view. Can someone tell me what I am missing here?

Thank you all,

aa
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: creating a UITableView on an "Utility application" project
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: UI blocking
  • Next by Date: Re: UI blocking
  • Previous by thread: Re: UI blocking
  • Next by thread: Re: creating a UITableView on an "Utility application" project
  • Index(es):
    • Date
    • Thread