美文网首页
iOS~表格

iOS~表格

作者: Wang99 | 来源:发表于2017-09-19 14:04 被阅读0次
                                                    //设置代理
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView *_tableView;
    NSMutableArray *_arr;
}
@end

@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    _tableView = [[UITableView alloc]initWithFrame:self.view.bounds];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [self.view addSubview:_tableView];
    
    _arr = [NSMutableArray arrayWithObjects:@"1",@"2",@"3",@"4", nil];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return _arr.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellID = @"cellID";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];
    }
    cell.textLabel.text = _arr[indexPath.row];
    return cell;
}

相关文章

  • iOS~表格

  • IOS表格的移动和删除

    简介ios表格有UICollectionView、UITableView两种格式,下面简单的整理了一下这两种表格的...

  • iOS表格FormTable

    在项目开发中,我们偶尔会用到表格来展示一些数据,但是在iOS的现有控件中,对于表格支持的不好,应该说并没有支持,所...

  • ios静态表格

    AppDelegate.m MyTableViewController.m 结果展示

  • iOS实现表格(非TableView)

    WhdeForm iOS 表格 项目地址:https://github.com/whde/WhdeForm 添加了...

  • 27个非常给力的iOS库

    iOS不倒,博客不停 DZNEmptyDataSet(UI,空表格视图解算器) DZNEmptyDataSet算是...

  • UITableView-01基础

    在iOS中要实现表格数据展示,最常用到的就是UITableView 是iOS比较重要的控件 UITableView...

  • 一些实用的小Demo值得收藏

    ios-charts:一个强大的iOS图表框架 excel表格形式的第三方 https://github.com/...

  • OS X中的表格视图

    OS X中的表格视图与IOS中的表格视图挺像的,区别在于OS X中的表格可以有多个列,还可以对各个列进行排序。列之...

  • 什么是UITableView

    什么是UITableView 在众多移动应用中,能看到各式各样的表格数据 在iOS中,要实现表格数据展示,最常用的...

网友评论

      本文标题:iOS~表格

      本文链接:https://www.haomeiwen.com/subject/ryvwsxtx.html