- 浏览: 904531 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (466)
- iPhone, iOS , Objective-c (155)
- 数据库 (20)
- 设计模式 (5)
- 第三方包管理,cocoapod (2)
- 版本管理, SVN, Subversion, Git (1)
- Google, Android, Java (14)
- Wordpress (1)
- 职业素养 (3)
- 版本管理,git (3)
- 前端小技巧 (2)
- flash (1)
- javascript (5)
- Ruby (0)
- 编程语言 (1)
- 网络常识 (1)
- 找到生活好感觉 (5)
- 产品经理 (1)
- markdown (1)
- 云服务器 (1)
- iPhone (116)
- iOS (116)
- Objective-c (116)
- 学习技巧 (2)
- Google (5)
- Android (6)
- Java (21)
- python (1)
- sqlite (3)
- node.js (2)
- mongodb (2)
- 学习技巧,阅读 (2)
- 软件测试 (3)
- 架构设计 (2)
- 设计 (1)
- Spring framework (3)
- junit (1)
- Linux (2)
- 软件 (1)
- Struts2 (1)
- 版本管理 (3)
- SVN (3)
- Subversion (3)
- Git (3)
- mysql (5)
- quartz (1)
- 无关技术 (1)
- 前端 (1)
- Redis (1)
- 产品管理 (0)
- 计算机常识 (1)
- 计算机科学 (0)
- swift (1)
- 服务器 (2)
- 搜索 (1)
- Scala (1)
- J2EE (1)
- maven (1)
- 前端css (1)
- 英语 (1)
- 消息队列 (1)
- kafka (0)
- apache kafka (4)
- netbeans (1)
- IDE (2)
- 歌词 (1)
- 过滤器实现 (1)
- linux vim vi (1)
- jmeter (1)
- springcloud (1)
最新评论
-
hujingnemo:
不知道为什么打不开
CHM如何改编字体大小 -
weiboyuan:
求答案 weiboyuanios@163.com
iOS软件工程师面试题(高级) -
xueji5368:
这个现在已经广泛使用了嘛!
RoboGuice入门 -
Yao__Shun__Yu:
...
CHM如何改编字体大小 -
353144886:
非常之详细 美女求认识
sqlite数据类型 datetime处理
1.需要引入AddressBook.framework框架
2.iPhone通讯录的增加联系人的操作,代码如下(放到项目中可直接运行):
// 初始化一个ABAddressBookRef对象,使用完之后需要进行释放,
// 这里使用CFRelease进行释放
// 相当于通讯录的一个引用
ABAddressBookRef addressBook = ABAddressBookCreate();
// 新建一个联系人
// ABRecordRef是一个属性的集合,相当于通讯录中联系人的对象
// 联系人对象的属性分为两种:
// 只拥有唯一值的属性和多值的属性。
// 唯一值的属性包括:姓氏、名字、生日等。
// 多值的属性包括:电话号码、邮箱等。
ABRecordRef person = ABPersonCreate();
NSString *firstName = @"四";
NSString *lastName = @"李";
NSDate *birthday = [NSDate date];
// 电话号码数组
NSArray *phones = [NSArray arrayWithObjects:@"123",@"456", nil];
// 电话号码对应的名称
NSArray *labels = [NSArray arrayWithObjects:@"iphone",@"home", nil];
// 保存到联系人对象中,每个属性都对应一个宏,例如:kABPersonFirstNameProperty
// 设置firstName属性
ABRecordSetValue(person, kABPersonFirstNameProperty, (CFStringRef)firstName, NULL);
// 设置lastName属性
ABRecordSetValue(person, kABPersonLastNameProperty, (CFStringRef) lastName, NULL);
// 设置birthday属性
ABRecordSetValue(person, kABPersonBirthdayProperty, (CFDateRef)birthday, NULL);
// ABMultiValueRef类似是Objective-C中的NSMutableDictionary
ABMultiValueRef mv = ABMultiValueCreateMutable(kABMultiStringPropertyType);
// 添加电话号码与其对应的名称内容
for (int i = 0; i < [phones count]; i ++) {
ABMultiValueIdentifier mi = ABMultiValueAddValueAndLabel(mv, (CFStringRef)[phones objectAtIndex:i], (CFStringRef)[labels objectAtIndex:i], &mi);
}
// 设置phone属性
ABRecordSetValue(person, kABPersonPhoneProperty, mv, NULL);
// 释放该数组
if (mv) {
CFRelease(mv);
}
// 将新建的联系人添加到通讯录中
ABAddressBookAddRecord(addressBook, person, NULL);
// 保存通讯录数据
ABAddressBookSave(addressBook, NULL);
// 释放通讯录对象的引用
if (addressBook) {
CFRelease(addressBook);
}
------------------------------------------------------------------------------------------------
3.删除联系人的操作,代码如下(放到项目中可直接运行):
// 初始化并创建通讯录对象,记得释放内存
ABAddressBookRef addressBook = ABAddressBookCreate();
// 获取通讯录中所有的联系人
NSArray *array = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
// 遍历所有的联系人并删除(这里只删除姓名为张三的)
for (id obj in array) {
ABRecordRef people = (ABRecordRef)obj;
NSString *firstName = (NSString *)ABRecordCopyValue(people, kABPersonFirstNameProperty);
NSString *lastName = (NSString *)ABRecordCopyValue(people, kABPersonLastNameProperty);
if ([firstName isEqualToString:@"三"] && [lastName isEqualToString:@"张"]) {
ABAddressBookRemoveRecord(addressBook, people, NULL);
}
}
// 保存修改的通讯录对象
ABAddressBookSave(addressBook, NULL);
// 释放通讯录对象的内存
if (addressBook) {
CFRelease(addressBook);
}
-------------------------------------------------------------------------------------------------
4.修改联系人的操作,代码如下(由于项目中使用到了修改联系人的操作,所以将方法直接复制过来了):
// 根据姓氏、名字以及手机号码修改联系人的昵称和生日
+ (void) updateAddressBookPersonWithFirstName:(NSString *)firstName
lastName:(NSString *)lastName
mobile:(NSString *)mobile
nickname:(NSString *)nickname
birthday:(NSDate *)birthday {
// 初始化并创建通讯录对象,记得释放内存
ABAddressBookRef addressBook = ABAddressBookCreate();
// 获取通讯录中所有的联系人
NSArray *array = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
// 遍历所有的联系人并修改指定的联系人
for (id obj in array) {
ABRecordRef people = (ABRecordRef)obj;
NSString *fn = (NSString *)ABRecordCopyValue(people, kABPersonFirstNameProperty);
NSString *ln = (NSString *)ABRecordCopyValue(people, kABPersonLastNameProperty);
ABMultiValueRef mv = ABRecordCopyValue(people, kABPersonPhoneProperty);
NSArray *phones = (NSArray *)ABMultiValueCopyArrayOfAllValues(mv);
// firstName同时为空或者firstName相等
BOOL ff = ([fn length] == 0 && [firstName length] == 0) || ([fn isEqualToString:firstName]);
// lastName同时为空或者lastName相等
BOOL lf = ([ln length] == 0 && [lastName length] == 0) || ([ln isEqualToString:lastName]);
// 由于获得到的电话号码不符合标准,所以要先将其格式化再比较是否存在
BOOL is = NO;
for (NSString *p in phones) {
// 红色代码处,我添加了一个类别(给NSString扩展了一个方法),该类别的这个方法主要是用于将电话号码中的"("、")"、" "、"-"过滤掉
if ([[p iPhoneStandardFormat] isEqualToString:mobile]) {
is = YES;
break;
}
}
// firstName、lastName、mobile 同时存在进行修改
if (ff && lf && is) {
if ([nickname length] > 0) {
ABRecordSetValue(people, kABPersonNicknameProperty, (CFStringRef)nickname, NULL);
}
if (birthday != nil) {
ABRecordSetValue(people, kABPersonBirthdayProperty, (CFDataRef)birthday, NULL);
}
}
}
// 保存修改的通讯录对象
ABAddressBookSave(addressBook, NULL);
// 释放通讯录对象的内存
if (addressBook) {
CFRelease(addressBook);
}
}
这几个是AddressBook 中的内容
ABRecordRef这个是某一条通讯录记录
ABMultiValueRef这个是通讯录中某一个可能有多个字段数值的记录
ABAddressBookRef 这货就是某个通讯录了
ABRecordID这个是记录的id, int类型
至于区别。。。这几个根本就不是一样的东西,谈不上区别
建议楼主去看下addressbook的相关官方例子ABUIGroups等等
github.com上面还有一个特棒的项目RHAddressBook
https://github.com/heardrwt/RHAddressBook
Include RHAddressBook in your iOS project.
#import <RHAddressBook/AddressBook.h>
Getting an instance of the addressbook.
RHAddressBook *ab = [[[RHAddressBook alloc] init] autorelease];
Support for iOS6+ authorization
//query current status, pre iOS6 always returns Authorized
if ([RHAddressBook authorizationStatus] == RHAuthorizationStatusNotDetermined){
//request authorization
[ab requestAuthorizationWithCompletion:^(bool granted, NSError *error) {
[abViewController setAddressBook:ab];
}];
}
Registering for addressbook changes
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addressBookChanged:) name:RHAddressBookExternalChangeNotification object:nil];
Getting sources.
NSArray *sources = [ab sources];
RHSource *defaultSource = [ab defaultSource];
Getting a list of groups.
NSArray *groups = [ab groups];
long numberOfGroups = [ab numberOfGroups];
NSArray *groupsInSource = [ab groupsInSource:defaultSource];
RHGroup *lastGroup = [groups lastObject];
Getting a list of people.
NSArray *allPeople = [ab people];
long numberOfPeople = [ab numberOfPeople];
NSArray *allPeopleSorted = [ab peopleOrderedByUsersPreference];
NSArray *allFreds = [ab peopleWithName:@"Fred"];
NSArray *allFredsInLastGroup = [lastGroup peopleWithName:@"Fred"];
RHPerson *person = [allPeople lastObject];
Getting basic properties on on a person.
NSString *department = [person department];
UIImage *thumbnail = [person thumbnail];
BOOL isCompany = [person isOrganization];
Setting basic properties on a person.
person.name = @"Freddie";
[person setImage:[UIImage imageNames:@"hahaha.jpg"]];
person.kind = kABPersonKindOrganization;
[person save];
Getting MultiValue properties on a person.
RHMultiDictionaryValue *addressesMultiValue = [person addresses];
NSString *firstAddressLabel = [RHPerson localizedLabel:[addressesMultiValue labelAtIndex]]; //eg Home
NSDictionary *firstAddress = [addressesMultiValue valueAtIndex:0];
Setting MultiValue properties on a person.
RHMultiStringValue *phoneMultiValue = [person phoneNumbers];
RHMutableMultiStringValue *mutablePhoneMultiValue = [[phoneMultiValue mutableCopy] autorelease];
if (! mutablePhoneMultiValue) mutablePhoneMultiValue = [[[RHMutableMultiStringValue alloc] initWithType:kABMultiStringPropertyType] autorelease];
//RHPersonPhoneIPhoneLabel casts kABPersonPhoneIPhoneLabel to the correct toll free bridged type, see RHPersonLabels.h
mutablePhoneMultiValue addValue:@"+14086655555" withLabel:RHPersonPhoneIPhoneLabel];
person.phonenumbers = mutablePhoneMultiValue;
[person save];
Creating a new person.
RHPerson *newPerson = [[ab newPersonInDefaultSource] autorelease]; //added to ab
RHPerson *newPerson2 = [[[RHPerson newPersonInSource:[ab defaultSource]] autorelease]; //not added to ab
[ab addPerson:newPerson2];
NSError* error = nil;
if (![ab save:&error]) NSLog(@"error saving: %@", error);
Getting an RHPerson object for an ABRecordRef for editing. (note: RHPerson might not be associated with the same addressbook as the original ABRecordRef)
ABRecordRef personRef = ...;
RHPerson *person = [ab personForRecordRef:personRef];
if(person){
person.firstName = @"Paul";
person.lastName = @"Frank";
[person save];
}
Presenting / editing an RHPerson instance in a ABPersonViewController.
ABPersonViewController *personViewController = [[[ABPersonViewController alloc] init] autorelease];
//setup (tell the view controller to use our underlying address book instance, so our person object is directly updated on our behalf)
[person.addressBook performAddressBookAction:^(ABAddressBookRef addressBookRef) {
personViewController.addressBook =addressBookRef;
} waitUntilDone:YES];
personViewController.displayedPerson = person.recordRef;
personViewController.allowsEditing = YES;
[self.navigationController pushViewController:personViewController animated:YES];
Background geocoding
if ([RHAddressBook isGeocodingSupported){
[RHAddressBook setPreemptiveGeocodingEnabled:YES]; //class method
}
float progress = [_addressBook preemptiveGeocodingProgress]; // 0.0f - 1.0f
Geocoding results for a person.
CLLocation *location = [person locationForAddressID:0];
CLPlacemark *placemark = [person placemarkForAddressID:0];
Finding people within distance of a location.
NSArray *inRangePeople = [ab peopleWithinDistance:5000 ofLocation:location];
NSLog(@"people:%@", inRangePeople);
Saving. (all of the below are equivalent)
BOOL changes = [ab hasUnsavedChanges];
BOOL result = [ab save];
BOOL result =[source save];
BOOL result =[group save];
BOOL result =[person save];
Reverting changes on objects. (reverts the entire addressbook instance, not just the object revert is called on.)
[ab revert];
[source revert];
[group revert];
[person revert];
Remember, save often in order to avoid painful save conflicts.
具体的例子可以看附件:
2.iPhone通讯录的增加联系人的操作,代码如下(放到项目中可直接运行):
// 初始化一个ABAddressBookRef对象,使用完之后需要进行释放,
// 这里使用CFRelease进行释放
// 相当于通讯录的一个引用
ABAddressBookRef addressBook = ABAddressBookCreate();
// 新建一个联系人
// ABRecordRef是一个属性的集合,相当于通讯录中联系人的对象
// 联系人对象的属性分为两种:
// 只拥有唯一值的属性和多值的属性。
// 唯一值的属性包括:姓氏、名字、生日等。
// 多值的属性包括:电话号码、邮箱等。
ABRecordRef person = ABPersonCreate();
NSString *firstName = @"四";
NSString *lastName = @"李";
NSDate *birthday = [NSDate date];
// 电话号码数组
NSArray *phones = [NSArray arrayWithObjects:@"123",@"456", nil];
// 电话号码对应的名称
NSArray *labels = [NSArray arrayWithObjects:@"iphone",@"home", nil];
// 保存到联系人对象中,每个属性都对应一个宏,例如:kABPersonFirstNameProperty
// 设置firstName属性
ABRecordSetValue(person, kABPersonFirstNameProperty, (CFStringRef)firstName, NULL);
// 设置lastName属性
ABRecordSetValue(person, kABPersonLastNameProperty, (CFStringRef) lastName, NULL);
// 设置birthday属性
ABRecordSetValue(person, kABPersonBirthdayProperty, (CFDateRef)birthday, NULL);
// ABMultiValueRef类似是Objective-C中的NSMutableDictionary
ABMultiValueRef mv = ABMultiValueCreateMutable(kABMultiStringPropertyType);
// 添加电话号码与其对应的名称内容
for (int i = 0; i < [phones count]; i ++) {
ABMultiValueIdentifier mi = ABMultiValueAddValueAndLabel(mv, (CFStringRef)[phones objectAtIndex:i], (CFStringRef)[labels objectAtIndex:i], &mi);
}
// 设置phone属性
ABRecordSetValue(person, kABPersonPhoneProperty, mv, NULL);
// 释放该数组
if (mv) {
CFRelease(mv);
}
// 将新建的联系人添加到通讯录中
ABAddressBookAddRecord(addressBook, person, NULL);
// 保存通讯录数据
ABAddressBookSave(addressBook, NULL);
// 释放通讯录对象的引用
if (addressBook) {
CFRelease(addressBook);
}
------------------------------------------------------------------------------------------------
3.删除联系人的操作,代码如下(放到项目中可直接运行):
// 初始化并创建通讯录对象,记得释放内存
ABAddressBookRef addressBook = ABAddressBookCreate();
// 获取通讯录中所有的联系人
NSArray *array = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
// 遍历所有的联系人并删除(这里只删除姓名为张三的)
for (id obj in array) {
ABRecordRef people = (ABRecordRef)obj;
NSString *firstName = (NSString *)ABRecordCopyValue(people, kABPersonFirstNameProperty);
NSString *lastName = (NSString *)ABRecordCopyValue(people, kABPersonLastNameProperty);
if ([firstName isEqualToString:@"三"] && [lastName isEqualToString:@"张"]) {
ABAddressBookRemoveRecord(addressBook, people, NULL);
}
}
// 保存修改的通讯录对象
ABAddressBookSave(addressBook, NULL);
// 释放通讯录对象的内存
if (addressBook) {
CFRelease(addressBook);
}
-------------------------------------------------------------------------------------------------
4.修改联系人的操作,代码如下(由于项目中使用到了修改联系人的操作,所以将方法直接复制过来了):
// 根据姓氏、名字以及手机号码修改联系人的昵称和生日
+ (void) updateAddressBookPersonWithFirstName:(NSString *)firstName
lastName:(NSString *)lastName
mobile:(NSString *)mobile
nickname:(NSString *)nickname
birthday:(NSDate *)birthday {
// 初始化并创建通讯录对象,记得释放内存
ABAddressBookRef addressBook = ABAddressBookCreate();
// 获取通讯录中所有的联系人
NSArray *array = (NSArray *)ABAddressBookCopyArrayOfAllPeople(addressBook);
// 遍历所有的联系人并修改指定的联系人
for (id obj in array) {
ABRecordRef people = (ABRecordRef)obj;
NSString *fn = (NSString *)ABRecordCopyValue(people, kABPersonFirstNameProperty);
NSString *ln = (NSString *)ABRecordCopyValue(people, kABPersonLastNameProperty);
ABMultiValueRef mv = ABRecordCopyValue(people, kABPersonPhoneProperty);
NSArray *phones = (NSArray *)ABMultiValueCopyArrayOfAllValues(mv);
// firstName同时为空或者firstName相等
BOOL ff = ([fn length] == 0 && [firstName length] == 0) || ([fn isEqualToString:firstName]);
// lastName同时为空或者lastName相等
BOOL lf = ([ln length] == 0 && [lastName length] == 0) || ([ln isEqualToString:lastName]);
// 由于获得到的电话号码不符合标准,所以要先将其格式化再比较是否存在
BOOL is = NO;
for (NSString *p in phones) {
// 红色代码处,我添加了一个类别(给NSString扩展了一个方法),该类别的这个方法主要是用于将电话号码中的"("、")"、" "、"-"过滤掉
if ([[p iPhoneStandardFormat] isEqualToString:mobile]) {
is = YES;
break;
}
}
// firstName、lastName、mobile 同时存在进行修改
if (ff && lf && is) {
if ([nickname length] > 0) {
ABRecordSetValue(people, kABPersonNicknameProperty, (CFStringRef)nickname, NULL);
}
if (birthday != nil) {
ABRecordSetValue(people, kABPersonBirthdayProperty, (CFDataRef)birthday, NULL);
}
}
}
// 保存修改的通讯录对象
ABAddressBookSave(addressBook, NULL);
// 释放通讯录对象的内存
if (addressBook) {
CFRelease(addressBook);
}
}
这几个是AddressBook 中的内容
ABRecordRef这个是某一条通讯录记录
ABMultiValueRef这个是通讯录中某一个可能有多个字段数值的记录
ABAddressBookRef 这货就是某个通讯录了
ABRecordID这个是记录的id, int类型
至于区别。。。这几个根本就不是一样的东西,谈不上区别
建议楼主去看下addressbook的相关官方例子ABUIGroups等等
github.com上面还有一个特棒的项目RHAddressBook
https://github.com/heardrwt/RHAddressBook
Include RHAddressBook in your iOS project.
#import <RHAddressBook/AddressBook.h>
Getting an instance of the addressbook.
RHAddressBook *ab = [[[RHAddressBook alloc] init] autorelease];
Support for iOS6+ authorization
//query current status, pre iOS6 always returns Authorized
if ([RHAddressBook authorizationStatus] == RHAuthorizationStatusNotDetermined){
//request authorization
[ab requestAuthorizationWithCompletion:^(bool granted, NSError *error) {
[abViewController setAddressBook:ab];
}];
}
Registering for addressbook changes
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addressBookChanged:) name:RHAddressBookExternalChangeNotification object:nil];
Getting sources.
NSArray *sources = [ab sources];
RHSource *defaultSource = [ab defaultSource];
Getting a list of groups.
NSArray *groups = [ab groups];
long numberOfGroups = [ab numberOfGroups];
NSArray *groupsInSource = [ab groupsInSource:defaultSource];
RHGroup *lastGroup = [groups lastObject];
Getting a list of people.
NSArray *allPeople = [ab people];
long numberOfPeople = [ab numberOfPeople];
NSArray *allPeopleSorted = [ab peopleOrderedByUsersPreference];
NSArray *allFreds = [ab peopleWithName:@"Fred"];
NSArray *allFredsInLastGroup = [lastGroup peopleWithName:@"Fred"];
RHPerson *person = [allPeople lastObject];
Getting basic properties on on a person.
NSString *department = [person department];
UIImage *thumbnail = [person thumbnail];
BOOL isCompany = [person isOrganization];
Setting basic properties on a person.
person.name = @"Freddie";
[person setImage:[UIImage imageNames:@"hahaha.jpg"]];
person.kind = kABPersonKindOrganization;
[person save];
Getting MultiValue properties on a person.
RHMultiDictionaryValue *addressesMultiValue = [person addresses];
NSString *firstAddressLabel = [RHPerson localizedLabel:[addressesMultiValue labelAtIndex]]; //eg Home
NSDictionary *firstAddress = [addressesMultiValue valueAtIndex:0];
Setting MultiValue properties on a person.
RHMultiStringValue *phoneMultiValue = [person phoneNumbers];
RHMutableMultiStringValue *mutablePhoneMultiValue = [[phoneMultiValue mutableCopy] autorelease];
if (! mutablePhoneMultiValue) mutablePhoneMultiValue = [[[RHMutableMultiStringValue alloc] initWithType:kABMultiStringPropertyType] autorelease];
//RHPersonPhoneIPhoneLabel casts kABPersonPhoneIPhoneLabel to the correct toll free bridged type, see RHPersonLabels.h
mutablePhoneMultiValue addValue:@"+14086655555" withLabel:RHPersonPhoneIPhoneLabel];
person.phonenumbers = mutablePhoneMultiValue;
[person save];
Creating a new person.
RHPerson *newPerson = [[ab newPersonInDefaultSource] autorelease]; //added to ab
RHPerson *newPerson2 = [[[RHPerson newPersonInSource:[ab defaultSource]] autorelease]; //not added to ab
[ab addPerson:newPerson2];
NSError* error = nil;
if (![ab save:&error]) NSLog(@"error saving: %@", error);
Getting an RHPerson object for an ABRecordRef for editing. (note: RHPerson might not be associated with the same addressbook as the original ABRecordRef)
ABRecordRef personRef = ...;
RHPerson *person = [ab personForRecordRef:personRef];
if(person){
person.firstName = @"Paul";
person.lastName = @"Frank";
[person save];
}
Presenting / editing an RHPerson instance in a ABPersonViewController.
ABPersonViewController *personViewController = [[[ABPersonViewController alloc] init] autorelease];
//setup (tell the view controller to use our underlying address book instance, so our person object is directly updated on our behalf)
[person.addressBook performAddressBookAction:^(ABAddressBookRef addressBookRef) {
personViewController.addressBook =addressBookRef;
} waitUntilDone:YES];
personViewController.displayedPerson = person.recordRef;
personViewController.allowsEditing = YES;
[self.navigationController pushViewController:personViewController animated:YES];
Background geocoding
if ([RHAddressBook isGeocodingSupported){
[RHAddressBook setPreemptiveGeocodingEnabled:YES]; //class method
}
float progress = [_addressBook preemptiveGeocodingProgress]; // 0.0f - 1.0f
Geocoding results for a person.
CLLocation *location = [person locationForAddressID:0];
CLPlacemark *placemark = [person placemarkForAddressID:0];
Finding people within distance of a location.
NSArray *inRangePeople = [ab peopleWithinDistance:5000 ofLocation:location];
NSLog(@"people:%@", inRangePeople);
Saving. (all of the below are equivalent)
BOOL changes = [ab hasUnsavedChanges];
BOOL result = [ab save];
BOOL result =[source save];
BOOL result =[group save];
BOOL result =[person save];
Reverting changes on objects. (reverts the entire addressbook instance, not just the object revert is called on.)
[ab revert];
[source revert];
[group revert];
[person revert];
Remember, save often in order to avoid painful save conflicts.
具体的例子可以看附件:
- ABUIGroups.zip (41.2 KB)
- 下载次数: 0
- QuickContacts.zip (33.9 KB)
- 下载次数: 2
发表评论
-
创建mysql数据库,默认字符集utf8
2017-10-10 09:58 841如下脚本创建数据库yourdbname,并制定默认的字符集是u ... -
MySql中文排序
2017-06-12 15:22 672在处理使用Mysql时,数据表采用utf8字符集,使用中发现中 ... -
mongodb设计套路
2017-06-10 11:40 428内嵌的方式性能更好 引用的方式方便写入更新 多对多关系多采用_ ... -
mysql bin文件还原
2016-01-14 10:38 8551.幸好本人养成了个好习惯,无论改动的大小我都会先备份一份数据 ... -
数据库三大范式
2015-12-07 15:12 650第一范式:确保每列的原子性. 如果每列(或者每个属性) ... -
命令行安装Redis
2015-11-18 18:02 639安装Redis cd ~ curl -O http://d ... -
MySql记录执行语句
2015-10-16 14:55 810-- 打开sql执行记录功能 set global log_o ... -
mysql常用聚合函数
2015-08-17 17:12 999原帖地址:http://blog.csdn.net/liaom ... -
让MySQL在 Mac OS X Yosemite上开机启动
2015-04-20 14:23 791先用命令行vi建立这个XML sudo vi /Library ... -
mySql count()函数
2015-03-09 16:29 605count() 仅仅是计算行数的. 仅仅当你 指定的列名里面 ... -
卸载windows下mysql数据库的方法
2015-03-02 13:23 0For Windows 7 and Windows 2008 ... -
iBatis加锁
2014-07-10 17:48 872ibatis有事务处理,它有代理类SqlMapExecutor ... -
sqlite数据库怎样实现全外连接
2014-07-02 20:37 1580sqlite数据库执行full outer join时提示:R ... -
转:DBA应该具有什么样的素质?
2014-05-22 13:57 741问题起源于在写一份材料的时候,对于自己的反思。 我把自己的 ... -
sqlite精华
2014-05-20 09:45 0数据库定义语言(DDL) 创建表 create [temp] ... -
UIImage变为NSData并进行压缩
2014-05-19 20:23 1929//sdk中提供了方法可以直接调用 UIImage *im ... -
update cocapods
2014-05-17 22:27 802早上更新cocoapod依赖库,发现更新到32.1版本,早先的 ... -
iOS发送短信息代码实例
2014-05-16 18:15 2687#import <MessageUI/Message ... -
DISPATCH TIMER
2014-05-14 16:12 729/* __block void (^callback) ... -
UITextField左边显示图片
2014-05-13 18:08 1171The overlay view displayed on t ...
相关推荐
在本项目中,"iPhone通讯录字母查找联系人源码" 是一个利用jQuery、CSS技术实现的模拟iPhone通讯录的功能。这个功能允许用户通过按住字母来快速查找并定位到以该字母为首字母的联系人,提高了用户在大量联系人列表中...
5. **Fetch Request**: 从Core Data数据库中获取数据的关键操作,用于查询特定的联系人信息。 6. **MVVM(Model-View-ViewModel)架构**: 这是一种常见的iOS应用设计模式,源码可能采用了这种架构,将数据模型、...
【描述】在描述中,"jquery仿iPhone通讯录"意味着开发者使用jQuery库来模拟iPhone通讯录的功能,包括滑动滚动、搜索联系人、点击显示详细信息等特性。这个项目可能涉及到HTML结构设计、CSS样式布局以及jQuery的事件...
本教程将深入探讨如何使用jQuery来创建一个仿iPhone通讯录的字母查找联系人效果,这一功能常见于移动设备的联系人应用中,能够帮助用户快速定位到特定联系人。 首先,我们需要理解基本原理。在iPhone的通讯录中,...
这涉及到DOM操作,我们需要找到所有匹配首字母的联系人,然后在页面上动态显示。jQuery提供了便利的DOM操作接口,如`$.each()`用于遍历数据,`$(selector).html()`用于更新HTML内容。 3. UI设计:为了模拟真实的...
利用CoreData的CRUD(创建、读取、更新、删除)操作,可以实现对联系人的添加、删除、修改。同时,CoreData还支持关系数据模型,意味着一个联系人可以有多个电话号码或电子邮件地址。 `TableView`是iOS中展示列表...
- 将iPhone连接至电脑,打开iTunes,选择“信息”选项,选取“Outlook”,同步联系人至iPhone。 以上三种方法各有优势,用户可根据自身情况和拥有的资源选择最适合的方式,顺利完成通讯录的迁移工作,享受无缝切换...
该资源是一个基于jQuery实现的仿iPhone通讯录首字母检索功能的源码包。这个特效能够帮助用户快速定位和查找联系人,类似于iPhone手机中的联系人应用,通过首字母索引栏进行滚动选择。以下是该源码包中涉及的主要知识...
4. **创建联系人**:要向通讯录添加新的联系人,可以通过创建一个`CNMutableContact`对象,设置其属性(如名字、电话号码、电子邮件等),然后使用`CNContactStore`的`save(_:to:completionHandler:)`方法保存到系统...
- **UI设计**:保持与iPhone通讯录相似的界面设计,包括字体、颜色、布局等,以提供一致的用户体验。 - **适配性**:确保应用能在不同分辨率和屏幕尺寸的设备上正常工作。 - **权限管理**:访问联系人数据需要获取...
这个应用的主要功能包括读取手机通讯录数据、展示联系人头像、提供快速滚动条以及支持联系人的增删改操作。以下是对这些功能的详细解释: 1. **读取手机通讯录信息**: 在iOS中,我们可以使用`Contacts`框架来访问...
通过有效地集成通讯录功能,应用可以提供更个性化的用户体验,比如自动填充联系人信息、快速分享功能、或者基于联系人网络的推荐系统。 ### iPhone通讯录API:AddressBook框架 AddressBook框架是苹果为开发者提供...
首先需要查询通讯录以获取指定联系人,然后进行删除操作。 ```swift let contactID = "your_contact_identifier" let predicate = CNContact.predicateForContacts(withIdentifier: [contactID]) let fetchRequest ...
QQView 可能包含了联系人列表的展示逻辑,比如使用 UITableView 来展示联系人的姓名、头像等信息,同时可能还实现了滑动选中、长按操作等交互功能。 知识点: 1. **联系人管理**:iOS 提供了 `AddressBook` 框架...
在本文中,我们将深入探讨如何使用jQuery来实现一个仿iPhone通讯录字母查找联系人的效果,这是一个常见的Web开发功能,尤其适用于构建用户友好的电话簿应用。这个功能的主要目的是通过按字母顺序快速查找并定位联系...
1. **数据管理**:通讯录中的联系人数据通常存储在苹果的Contacts框架中,开发者需要了解如何使用CNContactStore来访问和操作联系人数据。这涉及到读取、写入、删除和更新联系人信息。 2. **UI设计**:iPhone通讯录...
- 直接在iPhone的“联系人”应用中导出CSV格式的通讯录备份,或使用360手机助手等第三方软件导出。 2. **通过邮件发送**: - 将CSV文件作为附件发送到自己的邮箱。 3. **在iPhone上设置邮箱**: - 在iPhone上...
7. 成功导入后,你的新iPhone就会显示SIM卡上的所有联系人,它们会被整合到你的iPhone通讯录中,与已有的联系人一起管理。 这个功能对于那些不使用iCloud或其他同步服务来备份联系人,或者从非Apple设备转移的用户...