我有一个简单的应用程序,我有一个表视图和依赖于数组的回调我使用reloadData方法重新加载表数据.最初加载前5-10次这个表视图没有任何问题.在使用应用程序之后,有时我注意到表视图是空白的,因为cellForRowAtIndexPath框架没有调用它.我验证了datasource&delegate设置正确并numberOfRowsInSection返回有效的正数.一旦我看到空白表视图,我就可以反复看到这个空白视图,直到我退出应用程序.我在控制台中没有收到任何错误或警告.我试图调整阵列但无济于事.
这是代码:
- (void)notifyArrayLoaded:(NSArray *)arr {
NSUInteger capacity = [arr count];
_tbDataArray = [[NSMutableArray alloc] initWithCapacity:capacity];
// _tbDataArray is filled with the data from arr
// Reload the table data
[_tableView reloadData];
}
Run Code Online (Sandbox Code Playgroud)
任何线索都将受到高度赞赏.
提前致谢.萨米特
嗨DeanWombourne,我没有viewDidUnLoad方法,但我有viewWillDisAppear方法,我在这里发布它.
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
[self.navigationController setNavigationBarHidden:NO animated:NO];
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
UIView *view = [window.subviews objectAtIndex:0];
view.transform = CGAffineTransformIdentity; …Run Code Online (Sandbox Code Playgroud)