网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

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://bjjierui.cn/article/isjiee.html

其他资讯