• iOS UI 07 uitableview


    //

    //  RootViewController.m

    //  ui - 07

    //

    //  Created by dllo on 15/11/18.

    //  Copyright (c) 2015 dllo. All rights reserved.

    //


    #import "RootViewController.h"


    @interface RootViewController () <UITableViewDataSource, UITableViewDelegate>


    @end


    @implementation RootViewController


    - (void)viewDidLoad {

        [super viewDidLoad];

        self.view.backgroundColor = [UIColor whiteColor];

        

        

        UITableView *table = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) style:UITableViewStylePlain];

        table.delegate = self;

        table.dataSource = self;

        [self.view addSubview:table];

        [table release];

        

        

        

        

        

        

        

        

        

        // Do any additional setup after loading the view.

    }






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

    {

        static NSString *cellstr = @"cell";

        UITableViewCell *Cell = [tableView dequeueReusableCellWithIdentifier:cellstr];

        if (nil == Cell) {

            Cell = [[[UITableViewCell alloc]initWithStyle:   UITableViewCellStyleValue1 reuseIdentifier:cellstr] autorelease];

    //            Cell.textLabel.text = @"18733324546";

                Cell.imageView.image =[UIImage imageNamed:@"1.png"];

            

        }

        if (1 == indexPath.section && 0 == indexPath.row) {

            Cell.textLabel.text = @"大哥";

            Cell.detailTextLabel.text = @"138847";

        }

        

            return Cell;

    }

    - (void)didReceiveMemoryWarning {

        [super didReceiveMemoryWarning];

        // Dispose of any resources that can be recreated.

    }

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

    {

        return 5;

    }

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView

    {

        return 3;

    }

    - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section

    {

        if (section == 0) {

            return @"A";

        }

        if (section == 1) {

            return @"B";

        }

        return @"c";

    }

    /*

    #pragma mark - Navigation


    // In a storyboard-based application, you will often want to do a little preparation before navigation

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

        // Get the new view controller using [segue destinationViewController].

        // Pass the selected object to the new view controller.

    }

    */


    @end


  • 相关阅读:
    【SQL】182. Duplicate Emails
    【SQL】181. Employees Earning More Than Their Managers
    【SQL】180. Consecutive Numbers
    【SQL】178. Rank Scores
    【SQL】177. Nth Highest Salary
    如何处理postman Self-signed SSL certificate blocked错误
    Radio checked 属性
    转成百分比
    内建函数
    队列
  • 原文地址:https://www.cnblogs.com/yuhaojishuboke/p/5043084.html
Copyright © 2020-2023  润新知