1 NSString *string = @"2013-08-12 20:13:43";2 3 NSDateFormatter *formatter = [[NSDateFormatter alloc] init];4 //格式一定要一致,否则无法转换5 formatter.dateFormat =...
分类:
其他好文 时间:
2014-11-24 18:56:54
阅读次数:
113
OC类属性我们知道在Objective-C中,使用@property配合@synthesize可以让编译器自动实现getter/setter方法,使用的时候也很方便,可以直接使用对象.属性的方法调用。NSString* name;NSUIntegerage;@property(nonatomic,c...
分类:
其他好文 时间:
2014-11-24 18:53:43
阅读次数:
157
例如: NSString *string = @"abavavasdsvx,as.dsf/,.[abcdefghijklmn]dgdfg"; NSRange start = [string rangeOfString:@"["]; NSRange end = [string r...
分类:
其他好文 时间:
2014-11-24 13:31:44
阅读次数:
187
-(BOOL)isValidateEmail:(NSString *)email { NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; NSPredicate *emailTest = [NSP.....
分类:
移动开发 时间:
2014-11-24 11:31:59
阅读次数:
170
#import @interface UIImage (ZB)+(UIImage *)imageWithName:(NSString *)name;@end#import "UIImage+ZB.h"@implementation UIImage (ZB)+(UIImage *)imageWithN...
分类:
其他好文 时间:
2014-11-24 00:45:41
阅读次数:
201
在开发IOS应用时,我们经常需要将素材分类,并放入相应地子目录中。在开发代码时,需要访问这些素材时,就需要获取对应的子目录路径。那么如何获取呢?获取应用路径首先,要找到应用所在的路径。NSString *bundlePath = [[NSBundle mainBundle] bundlePath];...
分类:
移动开发 时间:
2014-11-23 18:45:22
阅读次数:
210
#import @class student;@interface DataBaseHandle : NSObject//设置单例+(DataBaseHandle *)shareDB;//获取沙盒document路径-(NSString *)documentPath;//打开数据库-(void)op...
分类:
数据库 时间:
2014-11-23 18:43:11
阅读次数:
290
NSRange (表示范围) location , length
初始化
NSRange range={4,5};
NSRange = NSMakeRange(4,5);
NSString *str = NSStringFromRange(range); 转成NSString...
分类:
其他好文 时间:
2014-11-23 11:45:38
阅读次数:
220
上代码吧,每块代码都可以直接跑,并附有注释和运行结果
//直接使用 == 严格匹配
NSArray *arrOriginal = [NSArray arrayWithObjects:@"c1",@"c", @"cd", @"cdd", @"cd", nil];
NSString *match = @"cd";
NSPredicate *predicate = [NSPredicate predi...
分类:
其他好文 时间:
2014-11-22 18:54:32
阅读次数:
176