iOS 静态度制作方法详细

iOS 静态度制作方法详细,第1张

概述按照步骤和我一起来: 第一步:创建一个新的工程,选择Framework,然后选择cocoa Touch Static Libarary ,添加你自己想要的名字ok,这里我取为“myLibrary” 第二步:在myLibrary.h中添加并改为 [html]  view plain copy #import <Foundation/Foundation.h>       #import <UIKit

按照步骤和我一起来:

第一步:创建一个新的工程,选择Framework,然后选择cocoa touch Static libarary ,添加你自己想要的名字ok,这里我取为“mylibrary”


第二步:在mylibrary.h中添加并改为

[HTML]  view plain copy #import <Foundation/Foundation.h>       #import UIKit/UIKit.h @interface mylibrary : NSObject   -(voID)testFunction;   @end  
第三步:在mylibrary.m中改为

copy #import "mylibrary.h"       @implementation mylibrary   -(voID)testFunction{   UIAlertVIEw *myAlert=[[UIAlertVIEw alloc] initWithTitle:@"哈哈,这个是静态库!"   message:@"成功了!"   delegate:self   cancelbuttonTitle:@"取消"   otherbuttonTitles:nil, nil];   [myAlert show];   [myAlert release];   }   @end   第四步:在左上角选择中改为iphone simulator


第五步:BulID  & Run,会在BulID文件夹里面有个libmylibrary.a的文件

第六步:新建工程testlibrary


第七步:导入生成的libmylibrary.a静态库和头文件,可以直接拖入到工程


第八步:在testlibrary 工程的

“VIEwController.m”文件的vIEwDIDLoad方法中添加

copy #import "VIEwController.h"   #import "mylibrary.h"   @interface VIEwController ()   @end   @implementation VIEwController   - (voID)vIEwDIDLoad   {   [super vIEwDIDLoad];   // Do any additional setup after loading the vIEw, typically from a nib.   mylibrary* pp=[[mylibrary alloc] init];   [pp testFunction];   [pp release];   }  
第九步:BulID  & Run 我们的testlibrary 工程 然后九看到效果了


最后还有就是这个libmylibrary.a静态库分为模拟器和真机的,切换也很方便就在


在这个地方切换为真机就ok了!

总结

以上是内存溢出为你收集整理的iOS 静态制作方法详细全部内容,希望文章能够帮你解决iOS 静态度制作方法详细所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1054393.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存