我有 2 个控制器 InitViewController 和 SettingsViewController。每个视图都有一个调用另一个视图的按钮:
初始化视图控制器
@interface InitViewController : UIViewController
- (IBAction)loadSettings:(id)sender;
@end
@implementation InitViewController
- (IBAction)loadSettings:(id)sender {
SettingsViewController *vc = [[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:nil];
[self presentViewController:vc animated:YES completion:nil];
vc = nil;
}
@end
设置视图控制器
@interface SettingsViewController : UIViewController
- (IBAction)back:(id)sender;
@end
@implementation SettingsViewController
- (IBAction)back:(id)sender {
InitViewController *vc = [[InitViewController alloc] initWithNibName:@"InitViewController" bundle:nil];
[self presentViewController:vc animated:YES completion:nil];
vc = nil;
}
@end
当我通过多次点击按钮来分析应用程序并对其进行测试时,我看到 InitViewController 和 SettingsViewController 的实例仍然存在 =>
我究竟做错了什么?