我還是比較新的,因爲這是我的第一個項目。但是我完全相信堆棧溢出社區,因爲您之前都曾幫助過我。NSlogging和NSString難題
我對你們所有人都有一個相當有趣的難題。我調用標準:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
在我的tableview將它推視圖控制器,並更新字符串的值(下面方法)(以串的變化是由不同的方法NSLogged):
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
appDelegate.baseURL = nil;
musicInteractionController = [[xSheetMusicViewController alloc]init];
if (indexPath.row == 0 && indexPath.section == 0) {
appDelegate.baseURL = @"mussette.pdf";
[self.navigationController pushViewController:musicInteractionController animated:YES];
}
else if (indexPath.row == 1 && indexPath.section == 0) {
appDelegate.baseURL = @"Importing PDF's.pdf";
[self.navigationController pushViewController:musicInteractionController animated:YES];
}
else if (indexPath.row == 2 && indexPath.section == 0) {
appDelegate.baseURL = @"Example.pdf";
[self.navigationController pushViewController:musicInteractionController animated:YES];
}
else if (indexPath.section == 1) {
appDelegate.baseURL = [[ivContentsList objectAtIndex:indexPath.row]lastPathComponent];
[self.navigationController pushViewController:musicInteractionController animated:YES];
}
[musicInteractionController release]; musicInteractionController = nil;
appDelegate.baseURL = nil;
}
我的代碼沒有錯誤,警告或內存泄漏。而且它由更新視圖以顯示當前PDF的新視圖控制器讀取的字符串更改。它可以正常工作,但不斷顯示相同的PDF,儘管NSLog值發生了變化。如果有幫助,我使用iOS模擬器,而不是真正的設備。
這是推後的第一個單元格,然後第二個(忽略無視圖控制器日誌,我認爲這是一個bug的示例NSLog的。此外,下來日誌是從第二個視圖中的私有方法,所以它可以也可以忽略,獎勵那些誰可以解決CGContextClipToRect:無效的情況下爲0x0警告):
2011-09-15 16:24:23.731 SheetMuse[43068:b603] value - (null)
Sep 15 16:24:27-MacBook SheetMuse[43068] <Error>: CGContextClipToRect: invalid context 0x0
Sep 15 16:24:27-MacBook SheetMuse[43068] <Error>: CGContextGetClipBoundingBox: invalid context 0x0
Sep 15 16:24:27-MacBook SheetMuse[43068] <Error>: CGContextConcatCTM: invalid context 0x0
Sep 15 16:24:27-MacBook SheetMuse[43068] <Error>: CGBitmapContextCreateImage: invalid context 0x0
2011-09-15 16:24:27.050 SheetMuse[43068:b603] Application tried to push a nil view controller on target <UINavigationController: 0x4c5e220>.
2011-09-15 16:24:27.069 SheetMuse[43068:b603] value - mussette.pdf
2011-09-15 16:24:27.072 SheetMuse[43068:b603] Application tried to push a nil view controller on target <UINavigationController: 0x4e74620>.
2011-09-15 16:24:27.097 SheetMuse[43068:b603] value - mussette.pdf
2011-09-15 16:24:33.944 SheetMuse[43068:b603] Down
Sep 15 16:24:36 MacBook-SheetMuse[43068] <Error>: CGContextClipToRect: invalid context 0x0
Sep 15 16:24:36 MacBook-SheetMuse[43068] <Error>: CGContextGetClipBoundingBox: invalid context 0x0
Sep 15 16:24:36 MacBook-SheetMuse[43068] <Error>: CGContextConcatCTM: invalid context 0x0
Sep 15 16:24:36 MacBook-SheetMuse[43068] <Error>: CGBitmapContextCreateImage: invalid context 0x0
2011-09-15 16:24:36.587 SheetMuse[43068:b603] Application tried to push a nil view controller on target <UINavigationController: 0x4c54bf0>.
2011-09-15 16:24:36.588 SheetMuse[43068:b603] value - Importing PDF's.pdf
2011-09-15 16:24:36.590 SheetMuse[43068:b603] Application tried to push a nil view controller on target <UINavigationController: 0x4c50790>.
2011-09-15 16:24:36.591 SheetMuse[43068:b603] value - Importing PDF's.pdf
在此先感謝。
在xSheetMusicViewController如果所選擇的小區,有什麼方法它讀取appDelegate.baseURL並加載PDF?顯示該方法。 – Anna
對不起,遲到的迴應。 appDelegate.baseURL作爲來自NSURL的CFURLRef在下一個視圖的 - (id)init方法中加載。 – CodaFi
在上面的代碼中,baseURL被設置_after_ init被調用,所以當init運行時,它將讀取以前的值。 – Anna