storyBoard 通过其进行界面跳转的封装类
来源:互联网 发布:java this的作用 编辑:程序博客网 时间:2024/06/09 15:35
首先写一个类别,用的时候直接调用类别的方法,下方是封装的类别的.h 和 .m文件:
.h文件
//// NSObject+PushNextControllerTool.h#import <Foundation/Foundation.h>@interface NSObject (PushNextControllerTool)/** * 通过UINavigationController进行界面的跳转 * * @param control 自己的现在的界面的控制器 即self 传入self * @param storyName 要跳转的界面所在的StoryBoard名字 * @param identifier 要跳转的界面在storyBoard中的控制器的标识符 * * @return nil */+(UIViewController *)PushWithSelfController:(UIViewController *)control NextViewControlerWithStorbordName:(NSString *)storyName withControllerIdentifier:(NSString *)identifier;@end
.m文件:
//// NSObject+PushNextControllerTool.m#import "NSObject+PushNextControllerTool.h"@implementation NSObject (PushNextControllerTool)+(UIViewController *)PushWithSelfController:(UIViewController *)selfController NextViewControlerWithStorbordName:(NSString *)storyName withControllerIdentifier:(NSString *)identifier{ UIStoryboard *MicroCourseLiveStoryBoard = [UIStoryboard storyboardWithName:storyName bundle:nil]; UIViewController *nextPageController = [MicroCourseLiveStoryBoard instantiateViewControllerWithIdentifier:identifier]; selfController.hidesBottomBarWhenPushed = YES; [selfController.navigationController pushViewController:nextPageController animated:YES]; return nextPageController;}@end
在控制器当中调用方法:
GuestIntroduceViewController *CourseChoVC = [UIViewController PushWithSelfController:self NextViewControlerWithStorbordName:@"CourseLiveRoom" withControllerIdentifier:@"GuestIntroduceViewController"];
该方法返回的是下一个界面的控制器,所以可以通过该控制器进行传值等等。。。例如 CourseChoVC.name = @"ddd"; 这样就可以吧下一个控制器所需要的name传递过去。
5 0
- storyBoard 通过其进行界面跳转的封装类
- Storyboard进行界面跳转及传值
- 使用storyboard的segue控制界面跳转
- 使用storyboard的segue控制界面跳转
- 使用storyboard的segue控制界面跳转
- IOS开发-使用Storyboard进行界面跳转
- Swift开发教程--使用Storyboard进行界面跳转
- 使用Storyboard进行界面跳转及传值
- swift_004(Storyboard进行界面跳转及传值)
- storyboard 界面跳转方法
- Storyboard实现界面跳转
- IOS storyboard文件界面跳转
- storyboard中的界面跳转(传值)
- iOS通过代码跳转到指定的StoryBoard
- iOS开发-使用Storyboard进行界面跳转及传值
- IOS开发-使用Storyboard进行界面跳转及传值
- iOS开发-使用Storyboard进行界面跳转及传值
- iOS开发-使用Storyboard进行界面跳转及传值
- 实时猫webrtc
- Java四种线程池的使用详解
- cache与buffer的区别联系
- PCB低功耗基础理解以及设计
- utf-8和utf8的区别
- storyBoard 通过其进行界面跳转的封装类
- 生产环境页面504问题--host地址配错问题
- JVM jconsole使用
- 十.一健康旅行,准备好我们的“芯生活”了吗?
- AndroidStudio2.2特征
- Java中字符串和整型的相互转换
- 从两个字符串中找出最大公共子字符串
- 删除无序链表中的重复值
- MFC对话框和控件