摘要: 原文地址:http://marshal.easymorse.com/archives/4149突然发现这么一篇文章 先留着吧 没这么用过之前,在在objc项目中使用常量中,使用c的预处理#define来设置常量。比如,可以做个头文件,然后在需要的类文件中import,使用常量。但这不是最佳实践。这样做可能是最好的方式,首先在比如叫Constants.h的头文件中:#import <Foundation/Foundation.h>extern NSString * const kInitURL;@interface Constants : NSObject {}@end这里使用到ex 阅读全文
posted @ 2012-11-08 22:23 SuperHappy 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 经常有需求 要判断不能为空,后台老是鄙视不做非空判断的前端 ,木办法 只能写一个。第一种想法:我不就是判断 是不是nil就可以了么。结果发现太天真,用户可以输入空格。对于这种蛋疼的用户,只能采取蛋疼的方法:-(Bool) isEmpty:(NSString *) str { if (!str) { return true; } else {//A character set containing only the whitespace characters space (U+0020) and tab (U+0009) and the newline and nextline cha... 阅读全文
posted @ 2012-11-08 22:12 SuperHappy 阅读(6881) 评论(0) 推荐(2) 编辑