用storyboard添加一個導(dǎo)航欄,其中首頁有一個switch,與setting聯(lián)動,還有一個button,使用modal連接另一個viewControl,其上也有一個按鈕,按下銷毀本viewControl,回到前一頁。
實現(xiàn)步驟:
1.創(chuàng)建一個SingleView的項目,勾選上storyboard。
2.向storyboard中添加一個NavigationController,兩個ViewController,然后在NavigationController中右擊指向第一個ViewController,然后設(shè)置為rootViewController,并且將箭頭指向NavigationController。
3.將兩個ViewController的Class分別設(shè)置為DXWViewController和DXWViewController1(兩個自己創(chuàng)建的類,繼承自ViewController)
4.創(chuàng)建setting文件,并將root.plist保存一個鍵值對,key改成switch
5.修改DXWViewController(主視圖)
DXWViewController.h:
#import @class DXWViewController1; @protocol DXWFlipsideViewControllerDelegate - (void)flipsideViewControllerDidFinish:(DXWViewController1 *)controller; @end @interface DXWViewController1 : UIViewController @property (assign, nonatomic) id delegate; - (IBAction)done:(id)sender; @end
DXWViewController.m:
#import "DXWViewController1.h" @interface DXWViewController1 () @end @implementation DXWViewController1 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)done:(id)sender { [self.delegate flipsideViewControllerDidFinish:self]; } @end
新聞名稱:[IOS]SettingBundle+StoryBoard
瀏覽地址:
http://weahome.cn/article/jgsppi.html