zoukankan      html  css  js  c++  java
  • ##DAY13——可视化编程之XIB

    ##DAY13——可视化编程之XIB

      1、关联控件

      2、关联事件

      3、关联手势

      4、关联代理

    这个时候即使不给控制器用下面方法添加代理,代理方法也是可以使用的,只是没有方法提示:

     

    其他重要地方:

    #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];
  • 相关阅读:
    黑马程序员_网络编程
    黑马程序员_ 异常
    黑马程序员_面向对象基础
    黑马程序员_循环语句的使用
    黑马程序员_面向对象深入2
    黑马程序员_ JAVA中的多线程
    黑马程序员_JAVA基础知识总结3
    OC-内存管理
    OC-核心语法(3)(分类、SEL、类本质)
    OC-核心语法2-构造方法
  • 原文地址:https://www.cnblogs.com/chongyu/p/5192458.html
Copyright © 2011-2022 走看看