摘要: 最近在利用SBJSON开发的过程中,发现SBJSON无法支持自定义的对象,为此考虑到了两种实现方案。一种在SBJSON框架一层实现一个自定义对象的Category以支持proxyForJson的方法。另一种方案就是应用层将自定义对象转换成属性名和属性值的字典后再交由SBJSON处理。鉴于本次SBJSON由一个底层库维护,折中方案就是在应用层进行自定义对象的处理。经过一番调查和搜索后,发现如下的实现方法:#import<Foundation/Foundation.h> #import<objc/runtime.h> @interfaceNSObject(PropertyL 阅读全文
posted @ 2013-05-16 15:32 @空空@ 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 用终端到程序目录下输入下面的命令:find ./ -name "*.m" -exec cat {} \; |wc -lfind ./ -name "*.h" -exec cat {} \; | wc -l两个数相加就是 阅读全文
posted @ 2013-04-08 10:40 @空空@ 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 1 UILabel *leftlabel=[[UILabel alloc]init]; 2 leftlabel.backgroundColor=[UIColor clearColor]; 3 CGFloat constrainedSize = 200.0f; 4 UIFont * myFont = [UIFont fontWithName:@"Arial" size:13]; 5 leftlabel.font=myFont; 6 CGSize textSize = [mystring sizeWithFont: myFont constrainedToSize:CGSize 阅读全文
posted @ 2013-03-18 12:04 @空空@ 阅读(271) 评论(0) 推荐(0) 编辑
摘要: AFNetwork是一个轻量级的网络请求api类库。是以NSURLConnection, NSOperation和其他方法为基础的。下面这个例子是用来处理json请求的:NSURL *url = [NSURL URLWithString:@"https://alpha-api.app.net/stream/0/posts/stream/global"];NSURLRequest *request = [NSURLRequest requestWithURL:url];AFJSONRequestOperation *operation = [AFJSONRequestOper 阅读全文
posted @ 2013-03-05 11:44 @空空@ 阅读(492) 评论(0) 推荐(0) 编辑
摘要: 方案如下:根据 [[UIApplication sharedApplication] enabledRemoteNotificationTypes] 的返回值来进行判断,该返回值是一个枚举值,如下:1234567typedefenum{UIRemoteNotificationTypeNone=0,UIRemoteNotificationTypeBadge=1<<0,UIRemoteNotificationTypeSound=1<<1,UIRemoteNotificationTypeAlert=1<<2,UIRemoteNotificationTypeNews 阅读全文
posted @ 2013-03-05 11:20 @空空@ 阅读(435) 评论(0) 推荐(0) 编辑
摘要: @代表“Objective-C”的标志,证明您正在使用Objective-C语言Objective-C语言关键词,@property与@synthesize配对使用。功能:让编译好器自动编写一个与数据成员同名的方法声明来省去读写方法的声明。如:1、在头文件中:C代码@propertyintcount;等效于在头文件中声明2个方法:C代码-(int)count;-(void)setCount:(int)newCount;2、实现文件(.m)中C代码@synthesizecount;等效于在实现文件(.m)中实现2个方法。C代码-(int)count{returncount;}-(void)set 阅读全文
posted @ 2013-03-05 10:15 @空空@ 阅读(294) 评论(0) 推荐(0) 编辑
摘要: 首先,将TTF字体拉入工程,然后在info.plist中添加一个新的键Fonts provided by application NSArray,item里面的string值为**.ttf,如图:接下来就是比较重要的了,一个字体文件包括以下几个内容:文件名、字体名称、字体具体名称,我们只有文件名,不知道字体名称是什么,更不知道具体的名称,那么我们就需要写代码获得具体的字体名称。NSArray* familys = [UIFont familyNames];for (int i = 0; i<[familys count]; i++) {NSString* family = [family 阅读全文
posted @ 2013-03-05 10:13 @空空@ 阅读(329) 评论(0) 推荐(0) 编辑