zoukankan      html  css  js  c++  java
  • iOS基础(四)——UIButton和UITableView

    1、懒加载button

    -(UIButton *)button{
        if (!_button) {
            _button = ({
                UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
                [button setTitle:@"内容显示" forState:UIControlStateNormal];
                button.titleLabel.font = [UIFont systemFontOfSize:14];
                [button addTarget:self action:@selector(clickButton:) forControlEvents:UIControlEventTouchUpInside];
                button;
            });
        }
        return _button;
    }
    

    2、懒加载tableview

    -(UITableView *)tableView
    {
        if (!_tableView) {
            _tableView = ({
                UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];
                tableView.dataSource = self;
                tableView.delegate = self;
                tableView.backgroundColor = [UIColor whiteColor];
                //设置分割线样式
                tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
                //tableview弹跳效果
                tableView.bounces=YES;
                //隐藏滚动条
                tableView.showsVerticalScrollIndicator = NO ;
                //隐藏底部多余分割线
                tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
                tableView ;
            }) ;
        }
        
        return _tableView;
    }
    
  • 相关阅读:
    面向对象的分析与设计
    Django的ORM补充
    JDBC数据库连接池
    Python 中的深浅拷贝
    智能机系统分析
    hyperf框架学习
    HTTP协议知识
    百度知道有关php抓取问题
    awk之FS的指定
    从DELPHI到JAVA[delphi]
  • 原文地址:https://www.cnblogs.com/smileK/p/9554128.html
Copyright © 2011-2022 走看看