2010-04-14 63 views
0
- (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是在MaSystemGuiAppDelegate.h中声明的NSMutableArray。它在MaSystemGuiAppDelegate.m的applicationDidFinishLaunching方法中被安装为:[[NSMutableArray alloc]init];ApplicationDelegate在这里没有做自己的工作!谁能帮我?

在上面的代码中,[tableData objectAtIndex:indexPath.row]正在检索tableview上触及的其中一个值。当我把这个值放在deneme(正如你在代码中看到的那样)时,没有任何东西被打印。

我错过了什么?

回答

1

试试这个:

的NSLog(@ “我行:%@”,appDelegate.deneme);

您需要告诉NSLog您想要打印传递给它的参数以及这些参数的格式是什么。

+0

非常感谢我总是错过那些位的东西..好..我怎么能将该值传递给另一个视图控制器实现类?其实这对我来说真的是2周的问题......因为我尝试了所有的可能性。 – user310000 2010-04-14 18:37:09

+0

我在最后得到了......:D :)现在我快乐了 – user310000 2010-04-14 18:41:27

相关问题