您可以使用ABPersonHasImageData
函数来检查联系人是否有图像。
下面是一个例子:
- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {
static NSString *id = @"id";
UITableViewCell *cell = [ tableView dequeueReusableCellWithIdentifier: id ];
if(!cell) cell = [[ UITableViewCell alloc ] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: id ];
ABRecordRef record = ...
UIImage *image;
if(ABPersonHasImageData(record)) {
//record has an image
image = [ UIImage imageWithData: ABPersonCopyImageData(record) ];
} else {
image = [ UIImage imageNamed: @"silhouette.png" ]; //just an example
}
cell.imageView.image = image;
// do other stuff with cell...
return cell;
}
核心基础类型是免费电话与基金类型(CF == NS)
真棒桥!正是我所需要的,并且像魅力一样工作。感谢您的快速帮助! – Andy 2010-05-13 03:45:33
@安迪,不客气! – 2010-05-13 03:47:13