Hi, everyone,
I want to ask a question about the iPhone application. I am writing a program with the UINavigationController, and I can click the UITableView cell and go to the detail page. However, I don't know how to create the following table view. (I use the didSelectRowAtIndexPath
to go to another page) How can I create this kind of table? As same as the UITableViewController?
link: http://www.freeimagehosting.net/image.php?02730817e4.png
// ---- Update -----
The detailViewController.h
#import <UIKit/UIKit.h>
@interface DetailViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> {
UIView *view;
UITableView *tableView;
}
@property (nonatomic, retain) UIView *view;
@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic, assign) id<UITableViewDataSource> dataSource;
@property (nonatomic, assign) id<UINavigationControllerDelegate> delegate;
@end
DetailViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
CGRect cgRct = CGRectMake(0.0, 0.0, 480, 320);
view = [[UIView alloc] initWithFrame:cgRct];
view.autoresizesSubviews = YES;
self.view = view;
tableView = [[[UITableView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 480.0f, 400.0f) style:UITableViewStyleGrouped] autorelease];
[view addSubview: tableView];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [dataArray count];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
NSString *title = nil;
switch (section) {
case 0:
title = @"First Name";
break;
case 1:
title = @"Middle Name";
break;
case 2:
title = @"Last Name";
break;
default:
break;
}
return title;
}
How to add the data from the clicked cell?