Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 在标准翻转侧视图中创建导航视图?_Objective C_Iphone_Uinavigationcontroller - Fatal编程技术网

Objective c 在标准翻转侧视图中创建导航视图?

Objective c 在标准翻转侧视图中创建导航视图?,objective-c,iphone,uinavigationcontroller,Objective C,Iphone,Uinavigationcontroller,有人知道如何在标准的翻转侧视图中创建导航视图来读取和更新设置吗?如果是这样的话,您可以发布一些代码来进行此操作。您可以将翻转侧视图作为UINavigationController的子类 或者,如果您只需要导航栏,而不需要推/弹出新的视图控制器,并且正在从NIB加载flipside视图,则只需在NIB文件中添加导航栏。您的应用程序委托头文件(MyAppDelegate.h): 这似乎是一个非常好的解决方案!但我很难让它工作。什么是rootViewController?我可以想象它是根的视图控制器,

有人知道如何在标准的翻转侧视图中创建导航视图来读取和更新设置吗?如果是这样的话,您可以发布一些代码来进行此操作。

您可以将翻转侧视图作为UINavigationController的子类


或者,如果您只需要导航栏,而不需要推/弹出新的视图控制器,并且正在从NIB加载flipside视图,则只需在NIB文件中添加导航栏。

您的应用程序委托头文件(MyAppDelegate.h):


这似乎是一个非常好的解决方案!但我很难让它工作。什么是
rootViewController
?我可以想象它是根的视图控制器,但这不意味着它应该首先以某种方式实现吗?我在调用像您使用
[(MyAppDelegate*)[UIApplication sharedApplication].delegate showSettings]
描述的方法时遇到问题。我尝试用UIApplication.sharedApplication.delegate.showSettings切换它,但仍然没有任何运气。。。希望你能帮上忙,因为这似乎是我最有可能采用的解决方案——如果我能让它奏效的话。
@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
- (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];
}