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

相關問題