1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問(wèn)題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
      iOS中tableView的分類有哪些

      這篇文章主要介紹iOS中tableView的分類有哪些,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

      偃師網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),偃師網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為偃師1000+提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)營(yíng)銷網(wǎng)站建設(shè)要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的偃師做網(wǎng)站的公司定做!

      大致分了一下,一個(gè)uitableview需要幾個(gè)方法去實(shí)現(xiàn), 創(chuàng)建一個(gè)tableivew,自定義一個(gè)cell,一個(gè)cell的模型,一個(gè)cell子控件的大小,復(fù)雜的話可以在加一個(gè)繼承tableview的方法1般是3種或者4種,或者是5種。

      #import "ViewController.h"

      @interface XXTableiewCell : UITableViewCell

      @end

      const float XXTableiewCell_fontSize = 12;

      @interface XXTableiewCell ()

      @property (strong, nonatomic) UILabel * titleLabel;

      @property (strong, nonatomic) UILabel * showTilleLable;

      @end

      @implementation XXTableiewCell

      + (instancetype)cellWithTableView:(UITableView *)tableView{

          static NSString *cellID = @"cellId";

           XXTableiewCell * cell = [[XXTableiewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];

          return cell;

      }

      - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

          self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];

          if(self){

              [self setViewUI];

          }

          return self;

      }

      - (void)setViewUI{

          _titleLabel = [[UILabel alloc] init];

          _titleLabel.font = [UIFont systemFontOfSize:XXTableiewCell_fontSize];

          _titleLabel.textColor = [UIColor grayColor];

          _titleLabel.textAlignment = NSTextAlignmentLeft;

          _titleLabel.backgroundColor = [UIColor clearColor];

          [self.contentView addSubview:_titleLabel];

          _showTilleLable = [[UILabel alloc] init];

          _showTilleLable.font = [UIFont systemFontOfSize:XXTableiewCell_fontSize];

          _showTilleLable.textColor = [UIColor grayColor];

          _showTilleLable.textAlignment = NSTextAlignmentLeft;

          _showTilleLable.backgroundColor = [UIColor clearColor];

          [self.contentView addSubview:_showTilleLable];

      }

      - (void)layoutSubviews{

          [super layoutSubviews];

          _titleLabel.frame = CGRectMake(10, 0, self.contentView.frame.size.width-20, 20);

          _showTilleLable.frame  = CGRectMake(_titleLabel.frame.origin.x, _titleLabel.frame.size.height + _titleLabel.frame.origin.y + 5, _titleLabel.frame.size.width, _titleLabel.frame.size.height);

      }

      @end

      @interface ViewController ()

      @property (strong,nonatomic)NSMutableArray * resultArry;

      @end

      @implementation ViewController

      - (void)viewDidLoad {

          [super viewDidLoad];

          _resultArry = [NSMutableArray arrayWithArray:[UIFont familyNames]];

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

          tableView.dataSource = self;

          tableView.delegate = self;

          [self setExtraCellLineHidden:tableView];

          [self.view addSubview:tableView];

      }

      // 隱藏多余cell

      -(void)setExtraCellLineHidden: (UITableView *)tableView

      {

          UIView *view = [UIView new];

          view.backgroundColor = [UIColor clearColor];

          [tableView setTableFooterView:view];

      }

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

      {

          return _resultArry.count;

      }

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

      {

        XXTableiewCell * cell = [XXTableiewCell cellWithTableView:tableView];

         cell.titleLabel.text = [NSString stringWithFormat:@"%ld",(NSInteger)indexPath.row + 1];

         cell.showTilleLable.text = [NSString stringWithFormat:@"%@",_resultArry[indexPath.row]];

          return cell;

      }

      #pragma mark-設(shè)置每一組的高度

      - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

      {

          return 50;

      }

      #pragma mark 設(shè)置選中處理方法

      - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

          NSLog(@"%ld",indexPath.row + 1);

      }

      - (void)didReceiveMemoryWarning {

          [super didReceiveMemoryWarning];

          // Dispose of any resources that can be recreated.

      }

      以上是“iOS中tableView的分類有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!


      網(wǎng)站標(biāo)題:iOS中tableView的分類有哪些
      當(dāng)前URL:http://ef60e0e.cn/article/iidgsj.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        临清市| 新密市| 通许县| 东光县| 阿合奇县| 荥阳市| 汉寿县| 梅河口市| 芜湖市| 沙雅县| 玛沁县| 黄石市| 贞丰县| 沛县| 西盟| 巨鹿县| 秦皇岛市| 永春县| 孝昌县| 德阳市| 秦安县| 龙里县| 涿州市| 通渭县| 上杭县| 城步| 常山县| 榆社县| 泸溪县| 夏河县| 文安县| 普宁市| 道真| 深泽县| 邯郸市| 襄城县| 绩溪县| 拉孜县| 庄河市| 榆中县| 广州市|