标签:
##DAY13——可视化编程之XIB
#import "Student.h" @interface StudentTableViewCell : UITableViewCell @property (strong, nonatomic) IBOutlet UIImageView *headerImageView; @property (strong, nonatomic) IBOutlet UILabel *nameLabel; @property (strong, nonatomic) IBOutlet UILabel *genderLabel; @property (strong, nonatomic) IBOutlet UILabel *phoneLabel; @property (strong, nonatomic) IBOutlet UILabel *introducedLabel; //@property (nonatomic, strong)Student *stu; - (void)sendValueByStudent:(Student *)student; @end @implementation StudentTableViewCell - (void)sendValueByStudent:(Student *)student { self.headerImageView.image = [UIImage imageNamed:student.icon]; self.nameLabel.text = student.name; self.genderLabel.text = student.sex; self.phoneLabel.text = student.phoneNumber; self.introducedLabel.text = student.introduce; } @end #define kStr @"reuse" - (void)viewDidLoad { [super viewDidLoad]; //tableView的行高自适应 self.tableView.rowHeight = UITableViewAutomaticDimension; //这个高度是预留高度,不影响自适应,只要不是0都可以 self.tableView.estimatedRowHeight = 1000; //如果使用XIB绘制cell的话,一定要注意,表视图必须注册cell类 [self.tableView registerNib:[UINib nibWithNibName:@"StudentTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:kReuse]; [self handelData];
标签:
原文地址:http://www.cnblogs.com/jiangllnew/p/5192458.html