Chr*_*nam 7 memory objective-c ios automatic-ref-counting
当用户单击按钮时,它会显示一个带有两个视图控制器的新标签栏视图控制器.我就是这样做的
ACLevelDownloadController *dvc = [[ACLevelDownloadController alloc] initWithNibName:@"ACLevelDownloadController" bundle:[NSBundle mainBundle]];
ACInstalledLevelsController *ivc = [[ACInstalledLevelsController alloc] initWithNibName:@"ACInstalledLevelsController" bundle:[NSBundle mainBundle]];
UITabBarController *control = [[UITabBarController alloc] init];
control.viewControllers = @[dvc, ivc];
dvc.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemFeatured tag:0];
ivc.tabBarItem = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemDownloads tag:1];
[self presentViewController:control animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
这很好用.我关闭那些视图控制器具有dismiss
在两个方法ACLevelDownloadController
和ACInstalledLevelsController
.这也很好.奇怪的是,当我呈现视图控制器时,内存使用率会上升
但它永远不会失败.如果我再次呈现它,它会更上升
我正在使用ARC.为什么视图控制器使用的内存在被解除后不被释放?
他们被解雇的方式是两者ACLevelDownloadController
并且ACInstalledLevelsController
已经连接了IBActions,当他们被点击时调用这个方法
- (void)dismiss:(id)sender{
[self dismissViewControllerAnimated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
9500 次 |
最近记录: |