Iphone App deve- Very basic table view but getting errors , trying for 2 days!! just for info using
- by user342451
Hi guys,
trying to write this code since 2 days now, but i keep getting error, it would be nice if anyone could sort this out, thanks.
Basically its the same thing i doing from the tutorial on youtube.
awaiting a reply
//
// BooksTableViewController.m
// Mybooks
//
//
import "BooksTableViewController.h"
import "BooksDetailViewController.h"
import "MYbooksAppDelegate.h"
@implementation BooksTableViewController
@synthesize BooksArray;
@synthesize BooksDetailViewController;
/*
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
// Initialization code
}
return self;
}
*/
(void)viewDidLoad {
[super viewDidLoad];
self.title = NSLocalizedString(@"XYZ",@"GOD is GREAT");
NSMutableArray *array = [[NSArray alloc] initWithObjects:@"H1",@"2",@"3",nil];
self.booksArray = array;
[array release];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
pragma mark Table view methods
(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.booksArray count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *identity = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identity];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:identity] autorelease];
}
// Set up the cell...
cell.textLabel.text = [booksArray objectAtIndex:indexPath.row];
return cell;
}
/*
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
booksDetailsViewControler *NC = [[booksDetailsViewControler alloc] initWithNibName:@"BooksDetailsView" bundle:nil];
[self.navigationController pushViewController:NC animated:YES];
//[booksDetailViewController changeProductText:[booksArray objectAtIndex:indexPath.row]];
}
*/
NSInteger row = [indexPath row];
if (self.booksDetailViewController == nil) {
BooksiDetailViewController *aCellDetails = [[AartiDetailViewController alloc] initWithNibName:@" BooksDetailViewController" bundle:nil];
self.booksDetailViewController = aCellDetails;
[aCellDetails release];
}
booksDetailViewController.title = [NSString stringWithFormat:@"%@", [booksArray objectAtIndex:row]];
//DailyPoojaAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
//[delegate.AartiNavController pushViewController:aartiDetailsViewControler animated:YES];
[self.navigationController pushViewController:aartiDetailViewController animated:YES];
}
/*
NSInteger row = [indexPath row];
if (self.booksDetailsViewControler == nil) {
AartiDetailsViewControler *aBookDetail = [[BooksDetailsViewControler alloc] initWithNibName:@"booksDetaislView" bundle:nil];
self.booksDetailsViewControler = aBookDetail;
[aBookDetail release];
}
booksDetailsViewControler.title = [NSString stringWithFormat:@"%@", [booksArray objectAtIndex:row]];
[self.navigationController pushViewController:booksDetailsViewControler animated:YES];
*/
(void)dealloc {
[aartiDetailViewController release];
[super dealloc];
}
@end