创建数组规定每组个数
NSArray *array = [UIFont familyNames];
_fontArray = [[NSMutableArray alloc]initWithCapacity:13];
NSMutableArray *temp = nil;
for (int index = 0; index < [array count]; index++) {
//取出字体
NSString *font =array[index];
if (index % 5 == 0) {
temp =[[NSMutableArray alloc]initWithCapacity:5];
[_fontArray addObject:temp];
[temp release];
}//将整除5时,创建temp数组,添加到 _fontArray
[temp addObject:font];//将字体放到temp 中
}
//将字体放入数组
时间: 2024-10-05 04:05:13