您的位置:首页 > 移动开发 > IOS开发

ios 页面跳转

2015-10-06 22:44 441 查看
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 运行即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  ios