• city。plist


    #import <UIKit/UIKit.h>

    #import "FirstTableViewController.h"

    @interface ViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>

    @property(strong,nonatomic) UITableView *table;

    @property(strong,nonatomic) NSArray *arr;

    @end

    #import <UIKit/UIKit.h>

    #import "FirstTableViewController.h"

    @interface ViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>

    @property(strong,nonatomic) UITableView *table;

    @property(strong,nonatomic) NSArray *arr;

    @end

    #import <UIKit/UIKit.h>

    @interface FirstTableViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>

    @property(strong,nonatomic)NSArray *arr;

    @property(strong,nonatomic)UITableView *table;

    @property(strong,nonatomic)NSString *str;

    @end

    #import "FirstTableViewController.h"

    @interface FirstTableViewController ()

    @end

    @implementation FirstTableViewController

    - (void)viewDidLoad {

        [super viewDidLoad];

        

    //  设置导航栏的前景色

        self.navigationController.navigationBar.barTintColor=[UIColor grayColor];

    //    设置导航栏字体颜色和大小

        [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont systemFontOfSize:30]}];

    //    设置标题

        self.title=self.str;

    //    初始化Table

        self.table=[[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];

    //    设置分隔符的颜色

        self.table.separatorColor=[UIColor redColor];

    //    设置代理

        self.table.delegate=self;

        self.table.dataSource=self;

        

        [self.view addSubview:self.table];

        

    //    设置唯一标识

        

        [self.table registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];

        

    }

    - (void)didReceiveMemoryWarning {

        [super didReceiveMemoryWarning];

        

    }

    #pragma mark - Table view data source

    //行数

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

    {

        return self.arr.count;

    }

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

        static NSString *cellIdentifi=@"cell";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifi forIndexPath:indexPath];

        

        cell.textLabel.text=self.arr[indexPath.row][@"city"];

        

        return cell;

    }

  • 相关阅读:
    More Effective C++ 条款34 如何在一个程序中结合C++和C
    More Effective C++ 条款33 将非尾端(non-leaf classes)设计为抽象类(abstract classes)
    More Effective C++ 条款32 在未来时态下发展程序
    win10子系统Ubuntu18.04下安装图形界面
    转载:Intel MKL 稀疏矩阵求解PARDISO 函数
    免费电子书下载
    Parallel Studio XE 调用 BLAS95 + LAPACK95 + IMSL
    linux后台运行和关闭、查看后台任务
    (转载)nohup命令让Linux程序永远在后台执行
    Linux 基本系统信息查询
  • 原文地址:https://www.cnblogs.com/tianlianghong/p/5289824.html
Copyright © 2020-2023  润新知