error at autorelease when prototype cell uses date from plist?
when I populate my tableview with a custom cell when it is using just
STRING from the plist I have no problem. but when i try to populate
cell.detailTextLabel.text = [partyTime objectAtIndex:indexPath.row];
partyTime in the plist was set to "date" format. it would crash. if i
changed the date to "string" and no problem. if i leave it as date i get
an error at Main.m autoreleasepool
@autoreleasepool {
return UIApplicationMain(argc, argv, nil,
NSStringFromClass([BaliPartyAppDelegate class]));
}
do i need to release NSDate? and Image? how?
this is my code so far
NSArray *parties;
NSArray *searchResults;
NSArray *tableData;
NSArray *thumbnails;
NSArray *partyTime;
}
@synthesize tableView;
- (void)viewDidLoad
{
[super viewDidLoad];
// Initialize table data
// parties = [NSArray arrayWithObjects:@"Snoop Dog", @"AVICII",
@"Frenzal Rhomb", @"Someone else", @"Cool Band", @"Lady Boys", nil];
// Find out the path of recipes.plist
NSString *path = [[NSBundle mainBundle] pathForResource:@"parties"
ofType:@"plist"];
// Load the file content and read the data into arrays
NSDictionary *dict = [[NSDictionary alloc] initWithContentsOfFile:path];
parties = [dict objectForKey:@"PartyName"];
thumbnails = [dict objectForKey:@"Thumbnail"];
partyTime = [dict objectForKey:@"PartyTime"];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
-
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation !=
UIInterfaceOrientationPortraitUpsideDown);
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
if (tableView == self.searchDisplayController.searchResultsTableView) {
return [searchResults count];
} else {
return [parties count];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"PartyCell";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:simpleTableIdentifier];
}
if (tableView == self.searchDisplayController.searchResultsTableView) {
cell.textLabel.text = [searchResults objectAtIndex:indexPath.row];
} else {
cell.textLabel.text = [parties objectAtIndex:indexPath.row];
cell.detailTextLabel.text = [partyTime objectAtIndex:indexPath.row];
//cell.imageView.image = [thumbnails objectAtIndex:indexPath.row];
}
return cell;
}
No comments:
Post a Comment