我正在使用自定义 Switch 视图控制器,您希望在不同视图之间切换时“视图已加载”功能或“视图已完成加载”功能运行但它们没有。这是我正在使用的:
- (IBAction)gotoKeyboardViews:(id)sender
{
YellowViewController *yellowController =
[[YellowViewController alloc]
initWithNibName:@"YellowViewController"
bundle:nil];
self.yellowViewController = yellowController;
[yellowController release];
[buttonKeyboard removeFromSuperview];
buttonStart = [UIButton buttonWithType:UIButtonTypeRoundedRect];
buttonStart.frame = CGRectMake(117,413, 103, 37);
[buttonStart setTitle:@"Restart" forState:UIControlStateNormal];
[buttonStart addTarget:self action:@selector(gotoBlueView:)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:buttonStart];
[blueViewController.view removeFromSuperview];
[self.view insertSubview:yellowViewController.view atIndex:0];
}
gotoKeyboardViews 假设将视图从 BlueView 切换到 YellowView ......但我认为我对实现导航栏有点偏离。请不要告诉我使用导航栏,因为我不喜欢它们在设计上的死板。