ApplicationDelegate is not doing its own job here ! Can anyone help me?
- (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 =开发者_如何学Go %@", [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 NSMutableArray
which is declared in MaSystemGuiAppDelegate.h. It's instatiated with: [[NSMutableArray alloc]init];
in the applicationDidFinishLaunching
method in MaSystemGuiAppDelegate.m.
In the code above, [tableData objectAtIndex:indexPath.row]
is retrieving one of the values touched on tableview. When I put that value in deneme
(as you can see in the code) nothing gets printed.
What am I missing?
Try this:
NSLog(@"my row: %@", appDelegate.deneme);
You need to tell NSLog that you want to print the parameters you are passing to it and what the format of those parameters are.
精彩评论