首页 文章 精选 留言 我的

精选列表

搜索[ios],共10000篇文章
优秀的个人博客,低调大师

iOS:LKDBHelper实体对象映射数据库-第三方框架(在FMDB的基础上进行二次封装)

一 插件简介: 其github地址:https://github.com/li6185377/LKDBHelper-SQLite-ORM 全面支持 NSArray,NSDictionary, ModelClass, NSNumber, NSString, NSDate, NSData, UIColor, UIImage, CGRect, CGPoint, CGSize, NSRange, int,char,float, double, long.. 等属性的自动化操作(插入和查询) 二 实例内容: 采用pods进行加载LKDBHelper插件,若有下载源代码调试时记得更新一下(平常项目中记得对libsqlite3.dylib进行引用); 本实例创建一个父实体BaseBean,后面其它实体都进行继承 1:父实体的代码内容 BaseBean.h内容: #import <Foundation/Foundation.h> #import <LKDBHelper/LKDBHelper.h> @interface BaseBean : NSObject @end //这个NSObject的扩展类 可以查看详细的建表sql语句 @interface NSObject(PrintSQL) +(NSString*)getCreateTableSQL; @end *这边可以放一些其它实体都公有的属性,及lkdbhelper数据库的地址;其中PrintSQL是对NSObject的扩展,可以查看创建表的sql语句; BaseBean.m内容: // BaseBean.m // LKDBHelperTest // // Created by mac on 16/2/17. // Copyright © 2016年 mac. All rights reserved. // #import "BaseBean.h" @implementation BaseBean /** * 创建数据库 */ +(LKDBHelper *)getUsingLKDBHelper { static LKDBHelper* db; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ NSString *sqlitePath = [BaseBean downloadPath]; NSString* dbpath = [sqlitePath stringByAppendingPathComponent:[NSString stringWithFormat:@"lkdbhelperTest.db"]]; db = [[LKDBHelper alloc]initWithDBPath:dbpath]; }); return db; } /** * 数据库存放路径 */ + (NSString *)downloadPath{ NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]; NSString *downloadPath = [documentPath stringByAppendingPathComponent:@"LKHTest"]; NSLog(@"%@",downloadPath); return downloadPath; } @end @implementation NSObject(PrintSQL) /** * 创建数据表 */ +(NSString *)getCreateTableSQL { LKModelInfos* infos = [self getModelInfos]; NSString* primaryKey = [self getPrimaryKey]; NSMutableString* table_pars = [NSMutableString string]; for (int i=0; i<infos.count; i++) { if(i > 0) [table_pars appendString:@","]; LKDBProperty* property = [infos objectWithIndex:i]; [self columnAttributeWithProperty:property]; [table_pars appendFormat:@"%@ %@",property.sqlColumnName,property.sqlColumnType]; if([property.sqlColumnType isEqualToString:LKSQL_Type_Text]) { if(property.length>0) { [table_pars appendFormat:@"(%ld)",(long)property.length]; } } if(property.isNotNull) { [table_pars appendFormat:@" %@",LKSQL_Attribute_NotNull]; } if(property.isUnique) { [table_pars appendFormat:@" %@",LKSQL_Attribute_Unique]; } if(property.checkValue) { [table_pars appendFormat:@" %@(%@)",LKSQL_Attribute_Check,property.checkValue]; } if(property.defaultValue) { [table_pars appendFormat:@" %@ %@",LKSQL_Attribute_Default,property.defaultValue]; } if(primaryKey && [property.sqlColumnName isEqualToString:primaryKey]) { [table_pars appendFormat:@" %@",LKSQL_Attribute_PrimaryKey]; } } NSString* createTableSQL = [NSString stringWithFormat:@"CREATE TABLE IF NOT EXISTS %@(%@)",[self getTableName],table_pars]; return createTableSQL; } @end 2:子实体CarBean的内容,其是另外一个实体UserBean的一个外键 CarBean.h内容: // // CarBean.h // LKDBHelperTest // // Created by mac on 16/2/17. // Copyright © 2016年 mac. All rights reserved. // #import "BaseBean.h" @interface CarBean : BaseBean @property(assign,nonatomic)int carID; @property(strong,nonatomic)NSString *carNum; @property(strong,nonatomic)NSString *address; @property(assign,nonatomic)float carWidth; @end CarBean.m内容: // // CarBean.m // LKDBHelperTest // // Created by mac on 16/2/17. // Copyright © 2016年 mac. All rights reserved. // #import "CarBean.h" @implementation CarBean +(void)initialize { //单个要不显示时 [self removePropertyWithColumnName:@"address"]; //多列要不显示时 //[self removePropertyWithColumnNameArray:]; //修改列对应到表时 重命名新列名 [self setTableColumnName:@"MyCarWidth" bindingPropertyName:@"carWidth"]; } /** * @brief 是否将父实体类的属性也映射到sqlite库表 * @return BOOL */ +(BOOL) isContainParent{ return YES; } /** * @brief 设定表名 * @return 返回表名 */ +(NSString *)getTableName { return @"carbean"; } /** * @brief 设定表的单个主键 * @return 返回主键表 */ +(NSString *)getPrimaryKey { return @"carID"; } /////复合主键 这个优先级最高 //+(NSArray *)getPrimaryKeyUnionArray //{ // return @[@"carID",@"carNum"]; //} @end *主要注意关于可以把一些属性过滤掉,就不会创建到表中,也可以对列名进行重定义,其它几个代码有详细说明 3:子实体UserBean,同样继承BaseBean UserBean.h内容: // // UserBean.h // LKDBHelperTest // // Created by mac on 16/2/17. // Copyright © 2016年 mac. All rights reserved. // #import "BaseBean.h" #import "CarBean.h" @interface UserBean : BaseBean @property(assign,nonatomic)int ID; @property(strong,nonatomic)NSString *userName; @property(strong,nonatomic)NSString *password; @property(assign,nonatomic)int age; @property(strong,nonatomic)CarBean *myCar; @end UserBean.m内容: // // UserBean.m // LKDBHelperTest // // Created by mac on 16/2/17. // Copyright © 2016年 mac. All rights reserved. // #import "UserBean.h" @implementation UserBean +(void)initialize { [self removePropertyWithColumnName:@"error"]; } /** * @brief 是否将父实体类的属性也映射到sqlite库表 * @return BOOL */ +(BOOL) isContainParent{ return YES; } /** * @brief 设定表名 * @return 返回表名 */ +(NSString *)getTableName { return @"userBean"; } /** * @brief 设定表的单个主键 * @return 返回主键表 */ +(NSString *)getPrimaryKey { return @"ID"; } @end 在ViewController类中测试: // // ViewController.m // LKDBHelperTest // // Created by mac on 16/2/17. // Copyright © 2016年 mac. All rights reserved. // #import "ViewController.h" #import <LKDBHelper.h> #import "BaseBean.h" #import "UserBean.h" @interface ViewController () @property (strong,nonatomic)LKDBHelper* globalHelper; @property (strong,nonatomic)UserBean *user; @property (strong,nonatomic)CarBean *car; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; [self test]; } /** * 开始进行针对数据库进行操作 功能包括删除所有表,清理指定表的数据,创建表插入数据,其中插入数据会自动判断表是否存在,若不存在则先创建表再插入,特别说明就是当一个列被定义为int且是主键时,它要是没有被赋值就会自动增长 */ -(void)test{ self.globalHelper = [BaseBean getUsingLKDBHelper]; //删除所有的表 [self.globalHelper dropAllTable]; //清理所有数据 [LKDBHelper clearTableData:[UserBean class]]; self.user=[[UserBean alloc] init]; //self.user.ID=1000; //特别说明 如果是主键 没给它赋值它就会自动增长 self.user.userName=@"WUJY"; self.user.password=@"123456"; self.user.age=10; self.car=[[CarBean alloc]init]; self.car.carNum=@"D88888"; self.car.address=@"厦门软件园"; self.car.carWidth=12.5; self.user.myCar=self.car; //插入数据 如果表不存在 它会自动创建再插入 实体实例化LKDBHelper 若是继承记得引用 否则会没有效果 [self.user saveToDB]; //另外一种插入 self.user.age=29; [self.globalHelper insertToDB:self.user]; } /** * 关于事务的操作 */ -(void)test2{ //事物 transaction 这边故意让它插入失败 [self.globalHelper executeForTransaction:^BOOL(LKDBHelper *helper) { self.user.ID = 10; self.user.userName=@"wujy10"; BOOL success = [helper insertToDB:self.user]; self.user.ID = 9; self.user.userName=@"wujy09"; success = [helper insertToDB:self.user]; //重复主键 self.user.ID = 10; BOOL insertSucceed = [helper insertWhenNotExists:self.user]; //insert fail if(insertSucceed == NO) { ///rollback return NO; } else { ///commit return YES; } }]; } /** * 关于异步操作,对于其它操作也同样支持异步操作,采用callback方式进行回调 */ -(void)test3{ self.user.userName=@"异步"; [self.globalHelper insertToDB:self.user callback:^(BOOL result) { NSLog(@"异步插入是否成功:%@",result>0?@"是":@"否"); }]; //异步查询 [self.globalHelper search:[UserBean class] where:nil orderBy:nil offset:0 count:100 callback:^(NSMutableArray *array) { for (id obj in array) { NSLog(@"异步:%@",[obj printAllPropertys]); } }]; } /** * 关于查询功能的几种操作,特别注意条件的写法,其它在代码中有相应的注解 */ -(void)test4{ NSMutableArray* searchResultArray=nil; //同步搜索 执行sql语句 把结果再变成对象 searchResultArray=[self.globalHelper searchWithSQL:@"select * from @t" toClass:[UserBean class]]; for (id obj in searchResultArray) { NSLog(@"sql语句:%@",[obj printAllPropertys]); } //使用对象对进查询操作 offset是跳过多少行 count是查询多少条 searchResultArray=[UserBean searchWithWhere:nil orderBy:nil offset:0 count:100]; for (id obj in searchResultArray) { NSLog(@"实体:%@",[obj printAllPropertys]); } //查询一列时的操作 count为0时则查所有列 NSArray* nameArray = [UserBean searchColumn:@"userName" where:nil orderBy:nil offset:0 count:0]; NSLog(@"%@",[nameArray componentsJoinedByString:@","]); //查询多列时的操作 NSArray* twoColumn=[UserBean searchColumn:@"ID,userName" where:nil orderBy:nil offset:0 count:0]; for (UserBean *obj in twoColumn) { NSLog(@"%d-%@",obj.ID,obj.userName); } //组合查询四种 and or like in searchResultArray=[UserBean searchWithWhere:[NSString stringWithFormat:@"userName like '%%JY%%'"] orderBy:nil offset:0 count:0]; NSLog(@"LIKE :%lu",searchResultArray.count); searchResultArray=[UserBean searchWithWhere:[NSString stringWithFormat:@"age=29 and userName='WUJY'"] orderBy:nil offset:0 count:0]; NSLog(@"AND :%lu",searchResultArray.count); searchResultArray=[self.globalHelper search:[UserBean class] where:@{@"age":@29,@"userName":@"WUJY"} orderBy:nil offset:0 count:0]; NSLog(@"AND %lu",searchResultArray.count); searchResultArray=[UserBean searchWithWhere:[NSString stringWithFormat:@"age=29 or userName='WUJY'"] orderBy:nil offset:0 count:0]; NSLog(@"OR %lu",searchResultArray.count); searchResultArray=[UserBean searchWithWhere:[NSString stringWithFormat:@"age in (10,29)"] orderBy:nil offset:0 count:0]; NSLog(@"in %lu",searchResultArray.count); searchResultArray=[self.globalHelper search:[UserBean class] where:@{@"age":@[@10,@29]} orderBy:nil offset:0 count:0]; NSLog(@"in %lu",searchResultArray.count); //查询符合条件的条数 NSInteger rowCount=[UserBean rowCountWithWhere:@"age=29"]; NSLog(@"rowCount %ld",rowCount); /* *注意: 单条件: @"rowid = 1" 或者 @{@"rowid":@1} 多条件: @“rowid = 1 and sex = 0" 或者 @{@"rowid":@1,@"sex":@0} 如果是or类型的条件,则只能用字符串的形式:@"rowid = 1 or sex = 0" in条件: @"rowid in (1,2,3)" 或者 @{@"rowid":@[@1,@2,@3]} 多条件带in:@"rowid in (1,2,3) and sex=0 " 或者 @{@"rowid":@[@1,@2,@3],@"sex":@0} 时间也只能用字符串: @"date >= '2013-04-01 00:00:00'" like也只能用字符串: @"userName like '%%JY%%'" */ } /** * 更新操作 */ -(void)test5{ NSMutableArray* searchResultArray=nil; //带条件更新 self.user.userName=@"踏浪帅"; BOOL isUpDate=[self.globalHelper updateToDB:self.user where:@{@"ID":@10}]; NSLog(@"是否更新成功:%@",isUpDate>0?@"是":@"否"); //根据条件获得后进行更新 searchResultArray=[UserBean searchWithWhere:[NSString stringWithFormat:@"userName='%@'",@"WUJY"] orderBy:nil offset:0 count:100]; self.user=[searchResultArray firstObject]; self.user.password=@"aa123456"; BOOL moreUpdate=[self.globalHelper updateToDB:self.user where:nil]; NSLog(@"根据条件获得后进行更新:%@",moreUpdate>0?@"是":@"否"); //更新 访问表名 更新内容跟条件进行更新 BOOL updateTab=[self.globalHelper updateToDBWithTableName:@"userBean" set:@"password='aa123456'" where:@"age=10"]; NSLog(@"访问表名更新内容跟条件进行更新:%@",updateTab>0?@"是":@"否"); //根据 实类进行更新 BOOL updateClass=[self.globalHelper updateToDB:[UserBean class] set:@"password='cnblogs'" where:@"userName='WUJY'"]; NSLog(@"根据实类进行更新:%@",updateClass>0?@"是":@"否"); } /** * 删除操作 */ -(void)test6{ //删除功能 self.user=[self.globalHelper searchSingle:[UserBean class] where:@{@"age":@10} orderBy:nil]; BOOL ishas=[self.globalHelper isExistsModel:self.user]; if (ishas) { [self.globalHelper deleteToDB:self.user]; } //删除多条 BOOL isDeleteMore=[self.globalHelper deleteWithClass:[UserBean class] where:@"age=29"]; if (isDeleteMore) { NSLog(@"符合条件的都被删除"); } } @end 程序猿神奇的手,每时每刻,这双手都在改变着世界的交互方式! 本文转自当天真遇到现实博客园博客,原文链接:http://www.cnblogs.com/XYQ-208910/p/5195144.html ,如需转载请自行联系原作者

优秀的个人博客,低调大师

iOS:时间格式化(标准时间转为时间戳、时间戳转为标准时间、时间戳转为日期)

新建一个NSString(Time)分类,创建类方法实现时间的转换 .h文件 #import <Foundation/Foundation.h> @interface NSString (KJTime) //时间戳--->时间 +(NSString *)transToTime:(NSString *)timsp; //时间戳--->日期 +(NSString *)transToDate:(NSString *)timsp; //时间---->时间戳 +(NSString *)transTotimeSp:(NSString *)time; @end .m文件 #import "NSString+KJTime.h" @implementation NSString (KJTime) //时间戳--->时间 +(NSString *)transToTime:(NSString *)timsp{ NSTimeInterval time=[timsp doubleValue];//如果不使用本地时区,因为时差问题要加8小时 == 28800 sec NSDate *detaildate=[NSDate dateWithTimeIntervalSince1970:time]; //实例化一个NSDateFormatter对象 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setTimeZone:[NSTimeZone localTimeZone]];//设置本地时区 //设定时间格式,这里可以设置成自己需要的格式 [dateFormatter setDateFormat:@"MM/dd HH:mm"]; NSString *currentDateStr = [dateFormatter stringFromDate: detaildate]; return currentDateStr; } //时间戳--->日期 +(NSString *)transToDate:(NSString *)timsp{ NSTimeInterval time=[timsp doubleValue];//如果不使用本地时区,因为时差问题要加8小时 == 28800 sec NSDate *detaildate=[NSDate dateWithTimeIntervalSince1970:time]; //实例化一个NSDateFormatter对象 NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setTimeZone:[NSTimeZone localTimeZone]];//设置本地时区 //设定时间格式,这里可以设置成自己需要的格式 [dateFormatter setDateFormat:@"MM月dd日"]; NSString *currentDateStr = [dateFormatter stringFromDate: detaildate]; return currentDateStr; } //时间---->时间戳 +(NSString *)transTotimeSp:(NSString *)time{ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setTimeZone:[NSTimeZone localTimeZone]]; //设置本地时区 [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; NSDate *date = [dateFormatter dateFromString:time]; NSString *timeSp = [NSString stringWithFormat:@"%ld", (long)[date timeIntervalSince1970]];//时间戳 return timeSp; } @end 程序猿神奇的手,每时每刻,这双手都在改变着世界的交互方式! 本文转自当天真遇到现实博客园博客,原文链接:http://www.cnblogs.com/XYQ-208910/p/5440989.html ,如需转载请自行联系原作者

优秀的个人博客,低调大师

【阿里云大学LIVE】今晚8点,借你双黑客眼 透视小贝邮件门、FBI大战IOS背后的网络安全真相

秘密是个有意思的东西。 多少人可以怀揣秘密安稳过一生我们并不知道,但至少小贝是没能做到。 讲真,小贝今年挺不顺利。前些天铺天盖地的邮件门大家也都看到。简单总结,泄露邮件的主要内容有两点,一是封爵失败后爆粗,二是不愿为慈善花钱。这一记重磅炸弹让我们万人迷小贝的完美人设瞬间崩塌,众多迷妹哀嚎男神幻灭,各国键盘侠更是火力全开狂喷不止。 事实上,邮件泄露早已不是什么新鲜事儿。 去年参与美国总统竞选的希拉里更是欲哭无泪:逃过了FBI,逃过了维基解密,最终却输给了一个钓鱼邮件。 是的,惹谁,也别惹黑客。他们不光能操纵破解你的邮件,还能远程越狱你的手机控制你的iPhone。 去年美国FBI为了破解苹果iPhone 5c手机,与一家专门从事手机安全的以色列公司Cellebrite展开了合作。不过悲剧的是,日前C

优秀的个人博客,低调大师

【iOS-cocos2d-X 游戏开发之十六】Cocos2dx编译后的Android自动使用(-hd)高清图&设置自适应屏幕

本篇主要介绍Cocos2dx项目开发过程中或者说项目务必遇到的一些知识点(ps.貌似Himi博客写的都是务必的 :tx: Himi认为写别人没写的才更容易吸引人不是~) OK,不多说废话,第一个介绍的是修改项目配置让你的Android项目支持自适应屏幕;其实关于Android项目自适应屏幕这个问题,Himi实在不想再多费口舌,一方面因为Himi之前博文有说过,另外一方面现在Android开源缘故造成分辨率泛滥也成必然。大家注意做项目尽可能使用相对位置,别写死坐标,另外一点就是针对流行分辨率做适应就好了,如果你们公司很有必要铺Android市场的量,那么只能一个一个分辨率去搞了=。 = Himi身为Kjava(J2me)一路走过来的Dev来说,我是在是对自适应虐到习惯..... 1. 咳咳,本不想说,回到正题,那么对于Cocos2dx中如何设置项目Android版自适应,其实很easy,直接在编译好的Android项目中如下路径查找: your Project name/Jni/helloworld/main.cpp OK,找到main.cpp后双击打开,然后看到如下代码段: //ifyouwanttoruninWVGAwithHVGAresource,setit view->create(480,320);//Pleasechangeitto(320,480);ifyou'reinportraitmode. view->create(480,320);默认关闭的,这里打开即可;其实Himi也是从cocos2dx引擎框架中看到的,打开你的任意一个cocos2dx引擎框架的项目,然后打开AppDelegate.cpp 文件,就能看到: 2. 下面继续介绍如何让你的cocos2dx-Android项目设置缩放比例,一样很easy,设置代码如下: CCDirector::sharedDirector()->setContentScaleFactor(2.0); 默认值是1.0,缩放2倍,从下面这两张图可以明显看出设置后的区别:(点击放大图片) 为了便于后续讲解更容易理解,那么这里Himi博文讲解使用的两行图片这里先给出,大家先看下: rect.png 规格: 40*40 | rect-hd.png 规格:80*80 3.下面介绍如何让cocos2dx的Android版项目使用iOSRetina类似@2x的-hd功能也直接使用高清图片,当然cocos2dx引擎默认找的高清图为-hd;但是编译Xcode的cocos2dx项目到Android版后,Android版可不会那么聪明自动使用你的-hd的版图片,所以下面Himi来手把手教你设置;具体步骤如下: 3.1首先在你的项目下找到 CCEGLView_android.cpp ,双击打开: 找到 void CCEGLView::create(int width, int height) 函数,然后函数内替换成如下代码: voidCCEGLView::create(intwidth,intheight) { if(width==0||height==0) { return; } m_sSizeInPoint.width=width; m_sSizeInPoint.height=height; //calculatethefactorandtherectofviewport m_fScreenScaleFactor=MIN((float)m_sSizeInPixel.width/m_sSizeInPoint.width,(float)m_sSizeInPixel.height/m_sSizeInPoint.height); CCLOG("CCEGLView::Create/ScreenScaleFactor=%f",m_fScreenScaleFactor); if(m_fScreenScaleFactor>=1.5f) { CCLOG("CCEGLView::Create/HDScaleFactor=>IncreaseContentScaleFactor"); cocos2d::CCDirector::sharedDirector()->setContentScaleFactor(2.0f); } intviewPortW=(int)(m_sSizeInPoint.width*m_fScreenScaleFactor); intviewPortH=(int)(m_sSizeInPoint.height*m_fScreenScaleFactor); m_rcViewPort.origin.x=(m_sSizeInPixel.width-viewPortW)/2; m_rcViewPort.origin.y=(m_sSizeInPixel.height-viewPortH)/2; m_rcViewPort.size.width=viewPortW; m_rcViewPort.size.height=viewPortH; m_bNotHVGA=true; } 3.2 继续在你的项目下找到CCFileUtils_android.cpp 类,双击打开: 找到 const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath) 函数,然后替换如下内容: constchar*CCFileUtils::fullPathFromRelativePath(constchar*pszRelativePath) { if(CC_CONTENT_SCALE_FACTOR()==2.0f) { //CC_RETINA_DISPLAY_FILENAME_SUFFIX //verifiersisuffixdejapresent std::stringpath=pszRelativePath; std::string::size_typepos=path.rfind("/")+1;//thebeginindexoflastpartofpath std::string::size_typesuffixPos=path.rfind(CC_RETINA_DISPLAY_FILENAME_SUFFIX); if((std::string::npos!=suffixPos)&&(suffixPos>pos)) { //=>ifyes,returnpathdirectly } else { //=>ifno,add"retina"/hdsuffixandtestiffileexist CCString*pRet=newCCString(); pRet->autorelease(); pRet->m_sString=path.substr(0,path.rfind("."))+CC_RETINA_DISPLAY_FILENAME_SUFFIX+path.substr(path.rfind("."),path.length()); if(existFileData(pRet->m_sString.c_str())) { //=>ifyes,returnpathwithsuffix CCLog("cocos2d:FilePath(%s)withsuffix(%s)exist,useit.",pRet->m_sString.c_str(),CC_RETINA_DISPLAY_FILENAME_SUFFIX); returnpRet->m_sString.c_str(); } else { //=>ifno,returnpathwithoutsuffix } } } returnpszRelativePath; } 然后接着在本类添加如下两个函数: boolCCFileUtils::existFileData(constchar*pszFileName) { stringfullPath(pszFileName); if((!pszFileName)) { returnfalse; } if(pszFileName[0]!='/') { //readfromapk fullPath.insert(0,"assets/"); returnCCFileUtils::existFileDataFromZip(s_strResourcePath.c_str(),fullPath.c_str()); } else { do { //readrromotherpaththanusersetit FILE*fp=fopen(pszFileName,"rb"); if(fp!=NULL) { fclose(fp); returntrue; } } while(0); } returnfalse; } boolCCFileUtils::existFileDataFromZip(constchar*pszZipFilePath,constchar*pszFileName) { unzFilepFile=NULL; boolres=false; do { CC_BREAK_IF(!pszZipFilePath||!pszFileName); CC_BREAK_IF(strlen(pszZipFilePath)==0); pFile=unzOpen(pszZipFilePath); intnRet=unzLocateFile(pFile,pszFileName,1); res=UNZ_OK==nRet; }while(0); if(pFile) { unzClose(pFile); } returnres; } 最后在CCFileUtils.h 中声明两个函数的定义: staticboolexistFileData(constchar*pszFileName); staticboolexistFileDataFromZip(constchar*pszZipFilePath,constchar*pszFileName); 3.3 最后记得设置缩放比例的值2.0,那么重新编译你的项目到Android运行则如下图所示: OK,本篇就到这里,Himi最近感冒,还没吃晚饭,咳咳,先晚饭去了。。。北京最近下雨天气偏凉~大家多注意身体, 本文转自 xiaominghimi 51CTO博客,原文链接:http://blog.51cto.com/xiaominghimi/969777,如需转载请自行联系原作者

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册
修改密码
忘记密码