iOS静态库结合Bundle隐藏代码,对外接口整理

1. 新建一个静态库工程bundle

成都创新互联专注于企业成都全网营销推广、网站重做改版、襄州网站定制设计、自适应品牌网站建设、HTML5商城网站制作、集团公司官网建设、外贸营销网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为襄州等各大城市提供网站开发制作服务。

iOS 静态库结合Bundle隐藏代码,对外接口整理

2. 新建一个Viewcontroller

iOS 静态库结合Bundle隐藏代码,对外接口整理

3. 新建一个Target Bundle并指定SDK为iOS, 并将TestViewController.xib加到Copy Bundle Resouce

iOS 静态库结合Bundle隐藏代码,对外接口整理

iOS 静态库结合Bundle隐藏代码,对外接口整理

5. bundle 代码如下

#import 
#import 
@interface bundle : NSObject
- (void) addViewController:(UIView *)view;
@end
#import "bundle.h"
#import "TestViewController.h"
@implementation bundle
- (void) addViewController:(UIView *)view
{
    NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"Test" withExtension:@"bundle"]];
    TestViewController *testCtrl = [[TestViewController alloc] initWithNibName:@"TestViewController" bundle:bundle];
    [view addSubview:testCtrl.view];
}
@end

6. 新建一个工程TestBundle, 把libbundle.a,Test.bundle拖入到工程中,然后调用即可

iOS 静态库结合Bundle隐藏代码,对外接口整理

#import "ViewController.h"
#import "bundle.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
           
    bundle * addView = [[bundle alloc] init];
    [addView addViewController:self.view];
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end

iOS 静态库结合Bundle隐藏代码,对外接口整理


网页标题:iOS静态库结合Bundle隐藏代码,对外接口整理
分享路径:http://bzwzjz.com/article/isjiee.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站制作 网站建设公司 成都网站制作 高端网站设计 定制网站设计 成都网站建设 网站制作 成都网站建设 高端网站设计 成都网站建设 网站设计公司 做网站设计 LED网站设计方案 H5网站制作 重庆企业网站建设 成都网站设计 网站建设方案 成都网站设计 营销网站建设 成都网站设计公司 网站建设改版 移动网站建设