有誰知道如何在標準Flipside視圖內創建一個導航視圖來讀取和更新設置?如果是這樣,你可以發佈一些代碼來做到這一點。在標準Flipside視圖內創建一個導航視圖?
1
A
回答
0
您可以使flipside視圖成爲UINavigationController的一個子類。
或者,如果您只需要導航欄,而無需推送/彈出新的視圖控制器,並且從NIB加載翻轉視圖,則只需在NIB文件中添加一個導航欄即可。
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];
}
相關問題
- 1. iPhone flipside視圖
- 2. MapView在主視圖和Flipside視圖中
- 3. 在視圖中創建一個視圖
- 4. 在WPF中從一個視圖導航到另一個視圖
- 5. 從另一個視圖創建視圖
- 6. 導航視圖
- 7. 在呈現第一個視圖後導航視圖控制器
- 8. 導航到另一個視圖時,在表視圖中的accessoryButtonTapped
- 9. 創建一個粘滯的視圖到導航條
- 10. Xcode 4.3 - 標準/視網膜導航欄圖標
- 11. 導航至視圖
- 12. Sencha導航視圖
- 13. 如何將一個視圖導航到其他視圖
- 14. 如何從子視圖導航到另一個視圖
- 15. 在視圖控制器內創建多個子視圖
- 16. 從MainView導航到另一個視圖
- 17. Ipad SplitViewController導航到另一個視圖
- 18. 從tableview導航到另一個視圖
- 19. 導航到另一個視圖iPhone SDK?
- 20. 導航到另一個視圖iPhone SDK?
- 21. Formpanel隨導航到另一個視圖
- 22. 導航欄視圖爲模態視圖?
- 23. 以模態視圖導航視圖
- 24. 如何在Caliburn.Micro中從一個視圖導航到另一個視圖?
- 25. 在第二個視圖上創建一個按鈕視圖
- 26. 從另一個標籤導航到子視圖時無法返回父視圖
- 27. 在組件/視圖內創建圖表?
- 28. 從導航欄視圖控制器導航到標籤欄視圖控制器
- 29. 標籤導航控制器,在第一個視圖中啓動
- 30. 將導航視圖移動到導航視圖的下方
看起來像一個非常好的解決方案!但是我有麻煩讓它工作。什麼是'rootViewController'?我會想象它是根視圖控制器,但是不是說它應該首先以某種方式實現嗎?我有麻煩調用像你描述的方法使用'[(MyAppDelegate *)[UIApplication sharedApplication] .delegate showSettings]''。我試着用UIApplication.sharedApplication.delegate.showSettings切換它,但仍然沒有任何運氣......希望你能幫忙,因爲看起來這是我最有可能去的解決方案 - 如果我能使它工作。 – 2009-12-23 17:00:45