本文转自long458的专栏,链接为http://blog.csdn.net/long458/article/details/41981273大体上,OC中常用的数组排序有以下几种方法:sortedArrayUsingSelector:;sortedArrayUsingComparator:;sor...
分类:
编程语言 时间:
2015-08-20 12:53:53
阅读次数:
153
众所周知,NSUserDefaults只能保存诸如NSArray、NSDictionary、NSData、NSNumber等基本数据类型,如果我们强制保存自定义的类,就会出现这个错误:Attempt to set a non-property-list object as an NSUserDefa...
分类:
其他好文 时间:
2015-08-19 23:25:51
阅读次数:
170
NSArray *segmentedArray = [NSArray arrayWithObjects:@"患者基本信息",@"患者信息",nil]; UISegmentedControl *segmentedControl = [[UISegmentedControl alloc]initWit....
分类:
其他好文 时间:
2015-08-19 22:34:06
阅读次数:
102
*********#import "ViewController.h"#import "Province.h"@interface ViewController ()@property (nonatomic,strong)NSArray *provinces;@property (nonatomic...
分类:
移动开发 时间:
2015-08-19 19:46:19
阅读次数:
152
在Objective-c中有int的数据类型,那为什么还要使用数字对象NSNumber?这是因为很多类(如NSArray)都要求使用对象,而int不是对象。NSNumber就是数字对象,我们可以使用NSNumber对象来创建和初始化不同类型的数字对象。#import NSNumber *myNu.....
分类:
其他好文 时间:
2015-08-19 19:29:14
阅读次数:
116
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
条件语句的优化要求判断一个NSArray有值,严谨的写法是...
分类:
其他好文 时间:
2015-08-19 16:59:00
阅读次数:
152
国旗选择#import "HMViewController.h"#import "HMFlag.h"#import "HMFlagView.h"@interface HMViewController ()@property(nonatomic,strong)NSArray *flags;@end@i...
分类:
移动开发 时间:
2015-08-19 16:29:59
阅读次数:
119
UIPickerView#import "ViewController.h"@interface ViewController ()@property (nonatomic,strong)NSArray *foods;@property (weak, nonatomic) IBOutlet UILa...
分类:
移动开发 时间:
2015-08-19 16:09:24
阅读次数:
121
Array是Swift中的数组数据类型,而NSArray是OC中的数组数据类型,两者有区别有联系。在Swift中有时候难免会使用到OC中的一些东西,今天我们就来Swift中使用NSArray和Array,并且进行转化。
(1)声明一个Array数组,并进行遍历,代码如下:
let stringArray: Array = ["10", "20","30","40","50"]
...
分类:
编程语言 时间:
2015-08-19 14:51:38
阅读次数:
111