iOS靜態(tài)庫結(jié)合Bundle隱藏代碼,對外接口整理

1. 新建一個靜態(tài)庫工程bundle

成都創(chuàng)新互聯(lián)專注于企業(yè)成都全網(wǎng)營銷推廣、網(wǎng)站重做改版、襄州網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、HTML5、商城網(wǎng)站制作、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)營銷網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價格優(yōu)惠性價比高,為襄州等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。

iOS 靜態(tài)庫結(jié)合Bundle隱藏代碼,對外接口整理

2. 新建一個Viewcontroller

iOS 靜態(tài)庫結(jié)合Bundle隱藏代碼,對外接口整理

3. 新建一個Target Bundle并指定SDK為iOS, 并將TestViewController.xib加到Copy Bundle Resouce

iOS 靜態(tài)庫結(jié)合Bundle隱藏代碼,對外接口整理

iOS 靜態(tài)庫結(jié)合Bundle隱藏代碼,對外接口整理

5. bundle 代碼如下

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@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拖入到工程中,然后調(diào)用即可

iOS 靜態(tài)庫結(jié)合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 靜態(tài)庫結(jié)合Bundle隱藏代碼,對外接口整理

分享文章:iOS靜態(tài)庫結(jié)合Bundle隱藏代碼,對外接口整理
瀏覽地址:http://muchs.cn/article44/isjiee.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、App設(shè)計(jì)全網(wǎng)營銷推廣、網(wǎng)站導(dǎo)航面包屑導(dǎo)航、微信公眾號

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)