【发布时间】:2011-04-11 00:41:45
【问题描述】:
我已经花了很多时间研究这个问题,但仍然找不到解决方案。这是用户经历的图表:
- 用户拍照或从他们的相机胶卷中拍照
- 只要他们选择(或选择)一个,标题视图就会关闭
- 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 函数中泄漏了内存。
-
theTableView 也被泄露了……你在哪里引用它显示为 nil 的 Tableview?
-
@Moshe:这是一个 UIViewController。
@interface processViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {我在我的 dealloc 中将两者都设为 nil,如下所示:- (void)dealloc { self.processList = nil; self.theTableView = nil; [super dealloc]; }。我看不到其他地方在泄漏? -
@Inspire48:请检查我更新的问题...谢谢!
-
中间的表格视图发生了什么?
标签: objective-c uitableview ios4 init