RJContactDetailsView 是一个用于显示联系信息的美丽视图,包括头像、姓名和电话号码。
下载项目的 zip 文件,并将类 RJContactDetailsView.h
和 RJContactDetailsView.m
放到您的项目中。示例中有简单的模型:RJContact.h
和 RJContact.m
。这是一个用于显示视图的模型。
#import "RJContactDetailsView.h"
RJContactDetailsView *contactDetailsView = [[RJContactDetailsView alloc] initWithHeadImage:[UIImage imageNamed:@"head"] contactName:@"rayjune" phones:@[@"15088888888",@"15067755555"]];
{
//set appearance
contactDetailsView.topBarColor = [UIColor blueColor];
contactDetailsView.intoDetailsButtonNormalTextColor = [UIColor blackColor];
contactDetailsView.intoDetailsButtonHightlightedTextColor = [UIColor lightTextColor];
contactDetailsView.contactNameLabelTextColor = [UIColor blackColor];
contactDetailsView.intoDetailsButtonTitle = @"More details";
contactDetailsView.headImage = [UIImage imageNamed:@"head"];
contactDetailsView.contactName = @"rayjune";
}
contactDetailsView.dataSource = self;
contactDetailsView.delegate = self;
[contactDetailsView show];
#pragma mark - RJContactDetailsView DataSource
- (UITableViewCell *)contactTableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath phones:(NSArray *)phones
{
static NSString *cellID = @"CellID";
UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
cell.textLabel.textColor = [UIColor blackColor];
cell.textLabel.font = [UIFont boldSystemFontOfSize:18];
cell.textLabel.text = phones[indexPath.row];
return cell;
}
#pragma mark - RJContactDetailsView Delegate
- (void)contactTableViewDidSelectPhone:(NSString *)phone
{
NSLog(@"You touched %@!",phone);
}
- (void)contactDetailsViewDidTouchedIntoDetails:(RJContactDetailsView *)contactDetailsView
{
NSLog(@"You touched into more details button!");
}
实际上,您可以以任何方式使用这些代码。如果您将其分叉或星标,我将非常高兴。