有谁知道如何在标准Flipside View中创建导航视图来读取和更新设置?如果是这样,你可以发布一些代码吗。
答案 0 :(得分:0)
您可以将flipside视图作为UINavigationController的子类。
或者,如果您只是需要导航栏,而无需推/弹新视图控制器并且正在从NIB加载翻转视图,则只需在NIB文件中添加导航栏。
答案 1 :(得分:0)
您的应用程序委托头文件(MyAppDelegate.h):
@interface MyAppDelegate : NSObject <UIApplicationDelegate> {
IBOutlet UIWindow *window;
// We're assuming the root view for the main view is connected to this outlet of the app delegate
// It'll probably have a different class than UIViewController in your app
IBOutlet UIViewController *mainViewController;
UINavigationController *settingsNavigationController;
}
// Other view controllers can do [(MyAppDelegate *)[UIApplication sharedApplication].delegate showSettings] to show the settings
- (void)showSettings;
- (void)hideSettings;
@end
您的应用程序委托.m文件(MyAppDelegate.m):
- (void)showSettings
{
// Load the settings view controller the first time it's needed
// We're assuming you created the root view controller for the settings in a nib called SettingsRootViewController.xib. You might also just create the root view programmatically (maybe by subclassing UITableViewController)
if(settingsNavigationController == nil)
{
SettingsRootViewController *settingsRootViewController = [[[SettingsRootViewController alloc] initWithNibName:@"SettingsRootViewController" bundle:nil] autorelease];
settingsNavigationController = [[UINavigationController alloc] initWithRootViewController:settingsRootViewController];
settingsNavigationController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal
}
[rootViewController presentModalViewController:settingsNavigationController animated:YES];
}
- (void)hideSettings
{
[settingsNavigationController dismissModalViewController:YES];
}