我花了很多時間查看此問題,但仍無法找到解決方案。下面是關於什麼的用戶經歷的圖表:UITableView返回null?
- 用戶拍攝照片或一旦他們採取(或選擇)一個從他們的相機膠捲
- 需要之一,captionView關閉
- 一旦作爲captionView關閉,從不同的觀點startUploads開始
- 如果用戶決定打開認爲startUploads是,他們可以看到已經上傳
現在你知道一點關於親我有幾個問題。上傳完成後,我希望它們淡出。我知道該怎麼做,但由於某種原因,當我打電話時,self.theTableView
返回null。我的.h中有一個@property (nonatomic, retain)...
,我的.m中有一個@sythesize theTableView;
。
在另一個問題中,我發現在做startUploads
時,我的NSMutableArray需要在這裏啓動(所以我認爲它會對我的UItableView執行相同的操作)。下面是我有:
- (id)initWithNibNamed:(NSString *)nibName bundle:(NSBundle *)bundle {
self = [super initWithNibNamed:nibName bundle:bundle];
if (self) {
processList = [[NSMutableArray alloc] init];
self.theTableView = [[UITableView alloc] init];
NSLog(@"thetableview: %@", theTableView);
}
return self;
}
以防萬一你想看到startUploads
是如何調用,下面的代碼:
processViewController *testtest = [[processViewController alloc] initWithNibName:@"processView.xib" bundle:nil];
//testtest.processList = [[NSMutableArray alloc] initWithNig];
NSLog(@"Different:displayProcessVC BEFORE STARTING UPLOAD, processList = %@", testtest.processList);
NSLog(@"Different:displayProcessVC BEFORE STARTING UPLOAD, theTableView = %@", testtest.theTableView);
[testtest startUploads];
NSLog(@"Different:displayProcessVC AFTER STARTING UPLOAD, processList = %@", testtest.processList);
NSLog(@"Different:displayProcessVC AFTER STARTING UPLOAD, theTableView = %@", testtest.theTableView);
[testtest release];
但是它仍然顯示在控制檯(null)
。
請幫忙!
庫爾頓
編輯1:
這裏就是它是零:
- (void)deleteOneRow: (NSString *)theString {
int theInt = [processList indexOfObject:theString];
[processList removeObjectAtIndex:theInt];
NSArray *deleteIndexPaths = [[NSArray alloc] initWithObjects: [NSIndexPath indexPathForRow:theInt inSection:0], nil];
NSLog(@"theTableView: %@", self.theTableView);
[self.theTableView beginUpdates];
[self.theTableView deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
[self.theTableView endUpdates];
}
您使用的是默認的UITableViewController嗎?另外,你似乎在init函數中泄漏內存。 – Moshe 2011-04-11 00:44:13
theTableView也正在泄露......你在哪裏引用Tableview,它顯示nil? – FeifanZ 2011-04-11 00:47:44
@Moshe:這是一個UIViewController。 '@interface processViewController:UIViewController {'我在我的dealloc中都是這樣的:' - (void)dealloc {self.processList = nil; self.theTableView = nil; [super dealloc]; }'。我看不到其他的東西在泄漏? –
iosfreak
2011-04-11 00:50:19