成都网站建设设计

将想法与焦点和您一起共享

[IOS]SettingBundle+StoryBoard

用storyboard添加一个导航栏,其中首页有一个switch,与setting联动,还有一个button,使用modal连接另一个viewControl,其上也有一个按钮,按下销毁本viewControl,回到前一页。

实现步骤:

1.创建一个SingleView的项目,勾选上storyboard。

2.向storyboard中添加一个NavigationController,两个ViewController,然后在NavigationController中右击指向第一个ViewController,然后设置为rootViewController,并且将箭头指向NavigationController。

3.将两个ViewController的Class分别设置为DXWViewController和DXWViewController1(两个自己创建的类,继承自ViewController)

4.创建setting文件,并将root.plist保存一个键值对,key改成switch

5.修改DXWViewController(主视图)

[IOS]Setting Bundle + StoryBoard

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://chengdu.cdxwcx.cn/article/jgsppi.html