well here are some parts of my code
first view controller is made through a nib file and it's code is here :
[CODE
#import "FirstViewController.h"
//#import "ResultsViewController.h"
@implementation FirstViewController
@synthesize textField,navigationController;
@synthesize resultsViewController;
-(IBAction)searchButtonPressed:(id)sender{
//RootViewController *temp = [[RootViewController alloc]init];
//[self pushViewController:temp animated:YES];
[selfpresentModalViewController:resultsViewControlleranimated:YES];
}
-(IBAction)textFieldDoneEditing:(id)sender{
[sender resignFirstResponder];
}
-(IBAction)backgroundTap:(id)sender{
textField.resignFirstResponder;
}
/*
// 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])) {
// Custom initialization
}
return self;
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[superviewDidLoad];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceO rientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[superdidReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[superviewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
textField.release;
[super dealloc];
}
@end
[/CODE]
and here is my root controller
[code]
@implementation RootViewController
@synthesize tmpCell, data;
#pragma mark -
#pragma mark View controller methods
- (void)viewDidLoad
{
[superviewDidLoad];
self.navigationController.navigationBar.tintColor = [UIColordarkGrayColor];
// Configure the table view.
self.tableView.rowHeight = 73.0;
self.tableView.backgroundColor = DARK_BACKGROUND;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
// Load the data.
NSString *dataPath = [[NSBundlemainBundle] pathForResource:@"Data"ofType:@"plist"];
self.data = [NSArrayarrayWithContentsOfFile:dataPath];
self.cellNib = [UINib nibWithNibName:@"IndividualSubviewsBasedApplicationCell" bundle:nil];
}
- (void)viewDidUnload
{
[superviewDidLoad];
self.data = nil;
self.tmpCell = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
returnYES;
}
#pragma mark -
#pragma mark Table view methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [data count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"ApplicationCell";
ApplicationCell *cell = (ApplicationCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[CompositeSubviewBasedApplicationCellalloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier] autorelease];
}
// Display dark and light background in alternate rows -- see tableView:willDisplayCell:forRowAtIndexPath:.
cell.useDarkBackground = (indexPath.row % 2 == 0);
// Configure the data for the cell.
NSDictionary *dataItem = [data objectAtIndex:indexPath.row];
cell.icon = [UIImage imageNamed:[dataItem objectForKey:@"Icon"]];
cell.publisher = [dataItem objectForKey:@"Publisher"];
cell.name = [dataItem objectForKey:@"Name"];
return cell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundColor = ((ApplicationCell *)cell).useDarkBackground ? DARK_BACKGROUND : LIGHT_BACKGROUND;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableViewdeselectRowAtIndexPath:indexPath animated:YES];
}
#pragma mark -
#pragma mark Memory management
- (void)dealloc
{
[data release];
[tmpCellrelease];
[super dealloc];
}
@end
[/code]