ios 页面跳转

来源:互联网 发布:sql 2008 r2 数据同步 编辑:程序博客网 时间:2024/04/29 13:41

MyThreeController 跳转到 MyFourController

1、点击new file生成cocoa Touch Class

这里写图片描述

2、 A、MyThreeController.h 定义方法

- (IBAction)openFourController:(id)sender;

B 、MyThreedController.m 实现方法

- (IBAction)openFourController:(id)sender {    UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];    MyFourController *myfourview=[mainStory instantiateViewControllerWithIdentifier:@"myfourcontroller"];    myfourview.delegate = self;    [self presentViewController:myfourview animated:NO completion:nil];    //[self performSegueWithIdentifier:@"mythreecontroller" sender:sender];    //    //调用此方法显示模态窗口    //  [self.navigationController pushViewController:mythreeview animated:YES];}

C、MyFourController.h

#import<UIKit/UIKit.h>@protocol MyThreeDelegate@end@interface MyFourController : UIViewController @property (nonatomic) id<MyThreeDelegate> delegate;@end

D、MyFourController.m

#import "MyFourController.h"@interface MyFourController()@end@implementation MyFourController@end

3、 步骤一:点击storyboard
步骤二:拖拽View Controller 控件到storyboard
步骤三:修改storyboard ID 和class 名字 ()
这里写图片描述

4、command+R 运行即可

0 0
原创粉丝点击