ApplicationDelegate is not doing its own job here ! Can anyone help me??
Posted
by ahmet732
on Stack Overflow
See other posts from Stack Overflow
or by ahmet732
Published on 2010-04-14T18:22:14Z
Indexed on
2010/04/14
18:23 UTC
Read the original article
Hit count: 248
objective-c
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
MaSystemGuiAppDelegate *appDelegate = (MaSystemGuiAppDelegate *)[[UIApplication sharedApplication] delegate];
appDelegate.deneme = [tableData objectAtIndex:indexPath.row] ;
NSLog(@"my row", appDelegate.deneme); // THIS IS NOT PRINTING
NSLog(@"my row = %@", [tableData objectAtIndex:indexPath.row]); //THIS IS PRINTING THE VALUE ON CONSOLE
NSInteger row = [indexPath row];
if(self.searchDetailViewController == nil){
SearchDetailViewController *asearchDetail = [[SearchDetailViewController alloc] initWithNibName:@"SearchDetailView" bundle:nil];
self.searchDetailViewController = asearchDetail;
[asearchDetail release];
}
searchDetailViewController.title = [NSString stringWithFormat:@"%@", [searchArray objectAtIndex:row]];
MaSystemGuiAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
[delegate.searchNavController pushViewController:searchDetailViewController animated:YES];
}
"deneme" is a NMUtableArray is identified in MaSystemGuiAppDelegate.h (I identified it as a variable and put its property there) and I wrote "deneme= [[NSMutableArray alloc]init]; in applicationDidFinishLaunching method in MaSystemGuiAppDelegate.m.
In the code above, [tableData objectAtIndex:indexPath.row] is retrieving the one of the value touched on tableview. When I put that value in deneme (as u noticed in the code) it is printing nothing.
What am i missing? (I imported MaSystemGuiAppDelegate.h)
© Stack Overflow or respective owner