摘要: 金陵城里金陵梦,石头城外伴石眠。秣陵秋至池荷尽,良辰好景是他年。 阅读全文
posted @ 2013-09-24 13:57 宸垣 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 前几天去面试,被问到了NSString属性声明中的copy和retain具体区别,对内存计数的影响,汗,当时没整明白,也没答出来,只知道NSString一般用copy.首先做以下几个变量声明:@property (retain, nonatomic) NSString *retainStr;@property (copy, nonatomic) NSString *copyStr;@property (retain, nonatomic) NSMutableString *retainMStr;@property (copy, nonatomic) NSMutableString *cop.. 阅读全文
posted @ 2012-10-12 13:53 宸垣 阅读(9962) 评论(0) 推荐(2) 编辑
摘要: 本文参考了这篇文章,主要做了补充说明:http://www.cnblogs.com/hellocby/archive/2012/08/23/2652201.html生成一个NSString类型的字符串有三种方法:方法1.直接赋值: NSString *testStr1 = @"a";方法2.类函数初始化生成: NSString *testStr2 = [NSString stringWithString:@"b"]; NSString *testStr3 = [NSString stringWithFormat:@"c"];方法3.实 阅读全文
posted @ 2012-10-10 23:09 宸垣 阅读(6773) 评论(0) 推荐(0) 编辑
摘要: 这几天看GCD,居然可以实现单例:- (id) sharedInstance{ static MySingleton *SharedInstance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ SharedInstance = [MySingleton new]; }); return SharedInstance; } 阅读全文
posted @ 2012-07-10 17:11 宸垣 阅读(255) 评论(0) 推荐(0) 编辑
摘要: 1.去掉首尾空格和换行符 [strstringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet] ]2.只去掉首尾空格: [strstringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet] ] 阅读全文
posted @ 2012-07-06 14:28 宸垣 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 编码规范一、文档结构管理1.建立Libraries文件夹,所有第三方库放入其中。2.建立Utilities文件夹,自已封装的类放入其中。3.建立Constants.h头文件,所有的常量定义于其中。Constants.h文件放入Main文件组里面。4.每个功能块放入一个Group,在目录里建立实际文件夹管理。5.程序资源文件放入Supporting Files文件夹中。如.plist、数据库资料等。6.在Supporting Files文件夹下建立Image、Music和Video等相关文件夹。图片、音频、视频等资源分别放入其中。图片资源以程序逻辑框架建立相应实体文件夹管理,若多个功能块共用的, 阅读全文
posted @ 2012-06-30 22:17 宸垣 阅读(6569) 评论(0) 推荐(1) 编辑
摘要: 在WBEngine.m文件里将如下方法里添加黑体部分代码,可清除Cookie,使登录后用islogin得到的标志位为更新后的标志位。- (void)deleteAuthorizeDataInKeychain{ self.userID = nil; self.accessToken = nil; self.expireTime = 0; NSHTTPCookie *cookie; NSHTTPCookieStorage *storage = [NSHTTPCookieStoragesharedHTTPCookieStorage]; for (cookie in [storage c... 阅读全文
posted @ 2012-06-20 09:59 宸垣 阅读(504) 评论(0) 推荐(0) 编辑
摘要: http://gaohaijun.blog.163.com/blog/static/1766982712011515111834192/ 阅读全文
posted @ 2012-06-10 19:02 宸垣 阅读(231) 评论(0) 推荐(0) 编辑
摘要: http://gaohaijun.blog.163.com/blog/static/176698271201151505129253/这是在ios开发中常见的功能。即,touch移动事件,是移动到当前视图的子视图中,还是移动到当前视图以外了。办法是,继承UIView,覆盖touchesMoved方法:- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch=[touches anyObject]; if (![self pointInside:[touch locationInView:se 阅读全文
posted @ 2012-06-10 18:54 宸垣 阅读(181) 评论(0) 推荐(0) 编辑
摘要: http://gaohaijun.blog.163.com/blog/static/17669827120115151129673/在java语言里,可以通过如下代码来实现加载类的时候执行对类的操作,一般叫:类初始块,或者,类加载块。比如:public class MyClass{ static{ …… }}在objc语言里,对应的机制是,类方法,load和initialize。比如:#import "Constants.h"@implementation Constants+ (void)initialize{ NSLog(@"init constants &g 阅读全文
posted @ 2012-06-09 23:49 宸垣 阅读(132) 评论(0) 推荐(0) 编辑