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];
  • 相关阅读:
    Spring 实践 -IoC
    HDU1584:蜘蛛牌(DFS)
    Linux命令缩写来由
    一道面试题:用shell写一个从1加到100的程序
    常用的OpenCV函数速查
    等差数列/等比数列通项公式与求和公式
    ubuntu给手机建wifi
    [转]C++之运算符重载(2)
    [转]C++之运算符重载(1)
    [转]C++之多态性与虚函数
  • 原文地址:https://www.cnblogs.com/chongyu/p/5192458.html
Copyright © 2011-2022 走看看