创建这样的文件
#import <UIKit/UIKit.h>
/**分组*/
@interface YYMGroup : NSObject
//联系人数据
@property(nonatomic,strong)NSMutableArray *items;
//大小(分组中有多少项)
@property (nonatomic, readonly) NSUInteger size;
//是否折叠
@property (nonatomic, assign, getter=isFolded) BOOL folded;
//初始化方法
- (instancetype) initWithItem:(NSMutableArray *)item;
@end
#import "YYMGroup.h"
@implementation YYMGroup
//初始化方法
- (instancetype) initWithItem:(NSMutableArray *)item{
if (self = [super init]) {
self.folded=YES;
_items = item;
}
return self;
}
//每个组内有多少联系人
- (NSUInteger) size {
return _items.count;
}
@end
#import "ViewController.h"
#import "YYMGroup.h"
#define WIDTH self.view.bounds.size.width
#define HEIGHT self.view.bounds.size.height
@interface