开发者

UITableView returns null?

I have spent many hours looking into this and I still can't find a solution. Here's a chart on what the user goes through:

  • The user takes a picture or takes one from their camera roll
  • As soon as they take (or select) one, the captionView closes
  • As soon as the captionView closes, startUploads from a different view starts
  • If the user decides to open the view that startUploads is in, they can see what has been uploaded

Now that you know a little bit about the process, I have a few issues. When uploads finish I want them to fade out. I know how to do that, but for some reason when I call to, the self.theTableView returns null. I have a @property (nonatomic, retain)... in my .h and I have a @sythesize theTableView; in my .m.

In a different question, I found out that when doing the startUploads, my NSMutableArray needed to be initiated in here (so I thought that it would do the same with my UItableView). Here's what I have:

- (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;
}

Just in case you want to开发者_JAVA百科 see how startUploads is called, here's the code:

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];

However it still shows (null) in the console.

Please help!

Coulton

EDIT 1:

Here's where it's being nil:

- (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];
}


The designated initializer for UITableView is -initWithFrame:style: and you're leaking. Try this in -viewDidLoad instead.

self.theTableView = [[[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain] autorelease];

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜