破冰
zcw_java · 共 130 篇文章
ios序列化对象存储本地
#import <Foundation/Foundation.h> @interface WeiboUserInfo : NSObject<NSCoding> { NSString *m_strDeviceJid; //绑定的设备的jid NSString *m_strSinaJid; //sina帐号的jid NSString *m_strSinaPasswd; //sina帐号密码 NSString *m_strNickName; //sina帐号的昵称 NSString *m_strSinaBrief; //sina个性签名 NSString *m_strAccessToken; //…
2013-09-10 14:14 · iPhone开发 · 评论(0)
Tableview详解
一,为tableview中cell,修改其样式 [tableview deselectrowatindexpath:indexpath animated:yes]; UITableViewCell *celling = [tableview cellforrowatindexpath:indexpath]; for (int i = 0; i < [m_mutarrinitmodeldatalist count]; i++) { NSIndexPath *indexPath1 = [nsindexpath indexpathforrow:i insection:0]; UITableView…
2013-08-22 15:47 · iPhone开发 · 评论(0)
使用MKNetworkKit函数Demo
一、引入MKNetworkKit 1, 添加MKNetworkKit的到工程目录。 2, 添加的CFNetwork.Framework,SystemConfiguration.framework,Security.framework和ImageIO.Framework。 3, PCH文件包含MKNetworkKit.h 4, 如果您正在构建针对iOS,删除NSAlert + MKNetworkKitAdditions.h文件。 5, 如果您正在构建的Mac,删除UIAlertView + MKNetworkKitAdditions.h文件。 二、MKNetworkKit类 1, MKNetw…
2013-08-16 13:41 · iPhone开发 · 评论(0)
ios国际化
前些天升级到Xcode4.5,现在正在用Xcode4.5+IOS6开发项目,当使用国际化时,遇到了一点问题,之前版本Xcode上新建Localizable.strings后,添加语言的“+”号不见了,找了半天无果,自己研究了下,后来在Stackoverflow上找到了解决方案,原来Apple把这个“+”号换地方了。下面来看看如何使用。 首先新建一个名为Localizable.strings的资源文件 完成后选中该文件,在属性选择器中可以看到多了个按钮: 点击这个按钮后,出现国际化语言选择框,但只有一个English的选项: 没关系,继续,点击Localize按钮,这时只支持英语。Xcode4…
2013-08-15 15:22 · iPhone开发 · 评论(0)
SDWebImage Demo手册
分享源码,有问题回复 SDWebImage 异步加载 缓存图片 Http请求次数限制等,期待大家共同研究学习 //清楚缓存、磁盘存储 -(void)removeImageForKey:(NSString *)key; key就是你那个;
2013-08-13 12:58 · iPhone开发 · 评论(0)
ios文件读写
//写入缓存文件,缓存目录下 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *strDocumentsDirectory = paths[0]; NSString *strCacheDirectoryName = [strdocumentsdirectory stringbyappendingpathcomponent:[nsstring stringwithformat:@"%@_alarm",@"2000000022"]];…
2013-08-12 15:44 · iPhone开发 · 评论(0)
ios使用预编译命令解决问题
对于MacOS设备不同,做出相应响应 #if TARGET_OS_IPHONE //iPhone真机 #elif TARGET_OS_MAC //Mac下 #elif TARGET_IPHONE_SIMULATOR //iPhone模拟器 #endif //结束 pch是对整个项目的预编译 #ifdef __OBJC__ #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> #import "AppDelegate.h" #endif
2013-08-12 13:44 · iPhone开发 · 评论(0)
tableview设置上下滚动高度,启用删除
可在viewDidAppear中实现加入 [tablvew setContentOffset:CGPointMake(0,480) animated:YES]; 在tableView内添加一个searchbar,一起滚动;开始时隐藏headerView(即让tableView向上滚动headerView的高度:默认44) UISearchBar *mySearchBar = init]; ; tableView.tableHeaderView = mySearchBar; //UITableView开始滚动到的位置(这样一开始headerView是不显示的) ; //启用删除 (void)t…
2013-08-06 17:14 · iPhone开发 · 评论(0)
NSMutableArray排序
NSMutableArray *array = ; for (int i = 0; i < 10; i ++) { ; Test23 *test = init]; test.name = ; test.date = ; ; ; } for (Test23 *test in array) { NSLog(@"%@",test.name); NSLog(@"%f",test.date.timeIntervalSince1970); } ; NSLog(@">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); for (Test23 *test in a…
2013-07-26 15:44 · iPhone开发 · 评论(0)
NSDate和NSString的转换
用于uidate,picker。。 +(NSDate*) convertDateFromString:(NSString*)uiDate { NSDateFormatter *formatter = [[nsdateformatter alloc] init] ; [formatter setdateformat:@"yyyy年mm月dd日"]; NSDate *date=[formatter datefromstring:uidate]; return date; } 输入的日期字符串形如:@"1992-05-21 13:08:08" - (NSDate *)dateFromString:…
2013-07-15 14:43 · iPhone开发 · 评论(0)
c++结构体在ios端解析
定义宏和结构体 #define ENTRYCOUNT 100 #define DATASIZE 256 typedef struct alarm_data_struct { int pos; char data[entrycount][datasize]; }stuct_alarm; 将NSString转换char - (const char *)NSStringToChar:(NSString *)string //将NSString转化为char { NSStringEncoding enc = CFStringConvertEncodingToNSStringEncoding (kCF…
2013-07-11 09:20 · iPhone开发 · 评论(0)
NSDate-常用操作及控制
对于NSDate常用操作整理,如有不足请补充 1,获取当前时区时间 //初始化时间段 NSDate *date = [nsdate date]; //获取当前时区 NSTimeZone *zone = [nstimezone systemtimezone]; //以秒为单位返回当前应用程序与世界标准时间(格林威尼时间)的时差 NSInteger interval = [zone secondsfromgmtfordate: date]; //补充时差后为当前时间 NSDate *localeDate = [date datebyaddingtimeinterval: interval]; 2…
2013-07-05 10:42 · iPhone开发 · 评论(0)
NotifiCationCenter控制使用
NSNotificationCenter 第一种,这个只是传值,通过NSNotification获取,当然也可以直接使用obj 注册A [[nsnotificationcenter defaultcenter] addObserver:self selector:@selector(enableOrDisableAudio:) name:@"enableOrDisableAudio" object:nil]; - (void)enableOrDisableAudio:(NSNotification *)notification { printf("enableOrDisableAudio\n…
2013-07-02 11:31 · iPhone开发 · 评论(0)
NSURL转NSData转UIImage
NSAutoreleasePool *pool = [[nsautoreleasepool alloc] init]; NSString *fileURL = [nsstring stringwithformat:@"http://%@/image/%@/show.jpg?n=%d", 1,1]; NSData *dateImg = [nsdata datawithcontentsofurl:[nsurl urlwithstring:fileurl]]; dispatch_sync(dispatch_get_main_queue(), ^{ m_imgViewVideo.image = [u…
2013-07-01 15:37 · iPhone开发 · 评论(0)