码迷,mamicode.com
首页 > 其他好文 > 详细

33.小项目:汽车列表 版本1.0

时间:2015-08-07 01:41:33      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

------------- ViewController.m -------------

 #import "ViewController.h"


@interface ViewController () <UITableViewDataSource>

@property (weak, nonatomic) IBOutlet UITableView *tableView;


@end


@implementation ViewController


- (void)viewDidLoad

{

    [super viewDidLoad];

    self.tableView.dataSource = self;

}


-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

{

    return 2;

}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{

    if (section == 0)

    {

        return 2;

    }

    else

    {

        return 3;

    }

}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

{

    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];

    cell.textLabel.text = @"宝马";

    return cell;

}


@end 

33.小项目:汽车列表 版本1.0

标签:

原文地址:http://www.cnblogs.com/lixiang2015/p/4709538.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!