NSString *path = NSHomeDirectory();//主目录 NSLog(@"NSHomeDirectory:%@",path); NSString *userName = NSUserName();//与上面相同 NSString *rootPath ...
分类:
移动开发 时间:
2015-08-19 19:37:16
阅读次数:
135
NSArray*persons=@[jack,tom,rose,lucy,bob,john,lily];//指定谓词条件NSPredicate*pre1=[NSPredicatepredicateWithFormat:@"age<40"];for(Person*personinpersons){//条件匹配//验证对象是否符合谓词pre1BOOLbool1=[pre1evaluateWithObject:person];if(bool1){NSLog(@"%@",..
分类:
编程语言 时间:
2015-08-19 17:51:49
阅读次数:
145
%@ Object
%d, %i signed int
%u unsigned int
%f float/double
%x, %X hexadecimal int
%o octal int
%zu size_t
%p pointer
%e float/double (in scientific notation)
%g float/double (as %f or %e, de...
分类:
移动开发 时间:
2015-08-19 11:16:42
阅读次数:
146
#import #import "AppDelegate.h"int main(int argc, char * argv[]) { //固定的字典类型 NSDictionary *dict=@{@"name":@"Netcorner",@"sex":@"male"}; NSLog...
分类:
其他好文 时间:
2015-08-18 15:47:26
阅读次数:
311
NSString *dateStr=@"2012-05-17 11:23:23";
NSLog(@"dateStr=%@",dateStr);
NSDateFormatter *format=[[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *f...
分类:
其他好文 时间:
2015-08-18 12:08:40
阅读次数:
101
block 常用于反向传值 声明返回值类型 (^block)(参数列表) 调用闭包的名字=^(参数列表){}; 闭包的名字();如:void(^aaaaa)(int num,NSString *Sring); aaaaa=^(int num,NSString *string){ NSLog...
分类:
其他好文 时间:
2015-08-17 23:08:20
阅读次数:
133
8月17日NSString一、字符串的创建 //1.创建常量字符串 NSString*str1 =@"hello world"; NSLog(@"%@",str1); //2.通过类方法创建字符串 NSString*str2 = [NSStringstringWithString:str1]; N....
分类:
其他好文 时间:
2015-08-17 21:31:39
阅读次数:
85
几种常见的用法为:字符串的创建、字符串的搜索、字符串的比较、字符串的转换用途一:字符串的创建 1 void ex1() 2 { 3 //1.常量字符串的对象 4 NSString *str1 = @"hello world"; 5 NSLog(@"str1 = %@",str...
分类:
其他好文 时间:
2015-08-17 21:16:56
阅读次数:
129
NSThread创建线程的方式
准备在后台线程调用的方法 longOperation:
- (void)longOperation:(id)obj {
NSLog(@"%@ - %@", [NSThread currentThread], obj);
}方式1:alloc / init - start- (void)threadDemo1 {
NSLog(@"before %@",...
分类:
编程语言 时间:
2015-08-16 00:41:34
阅读次数:
130