多个storyboard开发应用程序,封装.bundle和.a不用xib使用storyboard!!!
一,封装.bundle和.a使用xib的方式前面已经说过了,具体方式不再赘述,简单介绍于下:
静态库加.h bundle:删plist,改sdk,加xib 简称psx三步
引用库的项目,加.a .bundle 编辑edit scheme
二,storyboard出现的比较晚,封装的教程如今全网仅此一家,方便开发!
首先创建静态库,方法都和以前的一样,就把xib换成storyBoard就行了,难就难在怎么引用上,下面介绍于下:
在跟控制器上声明一个属性一个方法,为了调用的时候更方便
//比如A控制器要跳转过来,就把A的实例赋值给此source属性然后调用 startViewController方法就可以跳转过来
@property (nonatomic,strong)UIViewController *sourceViewController;
//启动该视图控制器,显示天气视图,为sourceViewController赋值之后就调用该方法
-(void)startViewController;
然后实现方式如下:
-(void)startViewController
{
NSBundle *bundle=[NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"WeatherDataLibResources" withExtension:@"bundle"]];
UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"WeatherStoryboard" bundle:bundle];
[self.sourceViewController presentViewController:[storyboard instantiateInitialViewController] animated:YEScompletion:^{
}];
}
三,在引用的地方先引入头文件,然后实例化,设置参数,方式如下:
WeatherViewController *weatherViewController=[[WeatherViewController alloc]init];
weatherViewController.sourceViewController=self;
[weatherViewController startViewController];
使用中遇到问题 Unknown class <class name> in interface Builder file.
遇到这个问题的人一时半会解决不了这个问题,真他妈蛋疼,我弄了一天多
解决:
1,xcode优化机制制造的这个问题,在任意一个类中调用一下这个类就行,比如打log或直接[类 class];
2,在project中的link flag加 -all_load
另外一个奇葩问题
[self.sourceViewController presentViewController:[storyboard instantiateInitialViewController] animated:YEScompletion:^{}];
这个方法可以显示视图,但是没有navigationBar!
还是直接使用push方法才能解决
在静态库中操作时经验终结:
使用模拟器.a
单例作为入口
built setting (other link) -objc (解决不是别类的bug)
[self presentViewController:controller animated:YES completion:^{
}];没有navigationBar可以显示,要换成 [self.navigationController pushViewController:qucontroller animated:YES];
多个storyboard开发应用程序,封装.bundle和.a不用xib使用storyboard!!!的更多相关文章
- iOS- Could not find a storyboard named 'Main' in bundle NSBundle
1.删掉工程中main.storyboard 后要删除plist文件中对应的键值,否则会报如下错误: Could not find a storyboard named 'Main' in bundl ...
- Could not find a storyboard named 'Main' in bundle NSBundle
转自:http://www.cnblogs.com/ygm900/p/3836580.html 1.删掉工程中main.storyboard 后要删除plist文件中对应的键值,否则会报如下错误: C ...
- 使用 Eclipse C/C++ Development Toolkit 开发应用程序
使用 Eclipse C/C++ Development Toolkit 开发应用程序 (转) 来自http://blog.csdn.net/favory/article/details/189080 ...
- BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 Excel Services中新功能
BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 Excel Services中新功能 从S ...
- UI5-文档-2.3-使用SAPUI5工具为Eclipse开发应用程序
用于为简单用例开发应用程序.用于Eclipse的SAPUI5应用程序开发工具提供向导来支持您以一种简单的方式创建应用程序.使用application project向导,将自动创建包含视图和控制器的必 ...
- BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 总结
BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 总结 SP2013新的server端Off ...
- BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 WOPI和新的Office Web Apps Server
BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 WOPI和新的Office Web Apps Server ...
- 微信小程序封装storage(含错误处理)
这次给你们安利的是微信小程序封装storage,先说下微信官方的 wx.getStorage({ key:"", success: function (res) { }, fail ...
- BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 新的机器翻译服务
BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第14章节--使用Office Services开发应用程序 新的机器翻译服务 机器翻译服务也是继Wor ...
随机推荐
- discuz核心类库class_core的函数注释
class discuz_core { // 数据库存储引擎 var $db = null; // 内存缓冲object var $mem = null; // 会话 object var $sess ...
- HDUoj-------(1128)Self Numbers
Self Numbers Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)To ...
- HDUOJ-------2493Timer(数学 2008北京现场赛H题)
Timer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...
- mysql jdbc连接
public class JDBCTest { public static void main(String[] args) { String sql = "SELECT * FROM us ...
- Objective-C:Category
Category可以在不需要创建子类或是修改原始类的基础上,动态为已经存在的类添加新的行为(方法),,这样可以保证类的原始设计规模较小,功能增加时再逐步扩展:实现了类的相关方法的模块化,把不同的类方法 ...
- MySQL 命令杂记
mysql> show processlist; 如果是root帐号,你能看到所有用户的当前连接.如果是其它普通帐号,只能看到自己占用的连接.show processlist;只列出前100条, ...
- .NET开发知识体系
记得几年前写过一篇关于.NET开发方面的知识总结,但是随着技术的发展以及自己技术理解的提升,觉得有必要对那篇文章加以更新和完善. 最近在园子里也看到有人写关于.NET知识体系的文章,特别是灵感之源写的 ...
- MySQL使用随笔
001 查看版本 mysql --version mysql > select version(); mysql > status; 002 新建MySQL用户.授权 insert int ...
- 优化MYSQL数据库的方法
1.选取最适用的字段属性,尽可能减少定义字段长度,尽量把字段设置NOT NULL,例如'省份,性别',最好设置为ENUM2.使用连接(JOIN)来代替子查询: a.删除没有任何订单客户:DELETE ...
- SuperGridControl 使用小技巧
1.显示行号 superGridControl1.PrimaryGrid.ShowRowGridIndex = true; 2.允许调整行头的宽度 superGridControl1.PrimaryG ...