1、定义联系人类AddressContact。实例变量:姓名、性别、电话号码、住址、分组名称。方法:自定义初始化方法(姓名、电话号码)、显示联系人信息
2、在main.m中定义可变数组,管理所有联系人。可以添加新联系人对象,如果姓名或电话号码为空,打印添加失败。
3、获取某个分组下的所有联系人。
4、根据电话号码搜索联系人。
5、获取所有女性联系人
6、根据姓名删除联系人
7、删除某个分组全部联系人
8、展示通讯录中所有联系人
9、选做:定义AddressBook类,封装上述功能。
main.m
//创建地址簿对象
AddressBook * book = [[AddressBook alloc] init];
AddressContact * p1 = [[AddressContact alloc] initWithName:@"小明" sex:@"男" phoneNum: @"12345566" address:@"龙东大道" groupName:@"同学"];
[book addPerson:p1];
[book showAddressBook];
// [book getPersonWithGroupName:@"同学"];
[book removePersonWithGroupName:@"同学"];
[book showAddressBook];
#import <Foundation/Foundation.h>
@interface AddressContact : NSObject
@property(nonatomic,retain) NSString * name;
@property(nonatomic,retain) NSString * sex;
@property(nonatomic,retain) NSString * phoneNum;
@property(nonatomic,retain) NSString * address;