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
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
      怎么在iOS中實(shí)現(xiàn)步驟進(jìn)度條功能-創(chuàng)新互聯(lián)

      今天就跟大家聊聊有關(guān)怎么在iOS中實(shí)現(xiàn)步驟進(jìn)度條功能,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

      龍口ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來市場(chǎng)廣闊!成為成都創(chuàng)新互聯(lián)公司的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!

      HQLStepView.h 文件

      #import 
      
      @interface HQLStepView : UIView
      
      // 指定初始化方法
      - (instancetype)initWithFrame:(CGRect)frame titlesArray:(NSArray *)titlesArray stepIndex:(NSUInteger)stepIndex;
      
      // 設(shè)置當(dāng)前步驟
      - (void)setStepIndex:(NSUInteger)stepIndex animation:(BOOL)animation;
      
      @end

      HQLStepView.m 文件

      #import "HQLStepView.h"
      
      // 步驟條主題色
      #define TINT_COLOR [UIColor colorWithRed:35/255.f green:135/255.f blue:255/255.f alpha:1]
      
      @interface HQLStepView ()
      
      @property (nonatomic, copy) NSArray *titlesArray;
      @property (nonatomic, assign) NSUInteger stepIndex;
      
      @property (nonatomic, strong) UIProgressView *progressView;
      @property (nonatomic, strong) NSMutableArray *circleViewArray;
      @property (nonatomic, strong) NSMutableArray *titleLabelArray;
      @property (nonatomic, strong) UILabel *indicatorLabel;
      
      @end
      
      @implementation HQLStepView
      
      #pragma mark - Init
      
      - (instancetype)initWithFrame:(CGRect)frame titlesArray:(NSArray *)titlesArray stepIndex:(NSUInteger)stepIndex {
       self = [super initWithFrame:frame];
       if (self) {
       _titlesArray = [titlesArray copy];
       _stepIndex = stepIndex;
      
       // 進(jìn)度條
       [self addSubview:self.progressView];
       
       for (NSString *title in _titlesArray) {
        
        // 圓圈
        UIView *circle = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 13, 13)];
        circle.backgroundColor = [UIColor lightGrayColor];
        circle.layer.cornerRadius = 13.0f / 2;
        [self addSubview:circle];
        [self.circleViewArray addObject:circle];
        
        // 標(biāo)題
        UILabel *label = [[UILabel alloc] init];
        label.text = title;
        label.font = [UIFont systemFontOfSize:14];
        label.textAlignment = NSTextAlignmentCenter;
        [self addSubview:label];
        [self.titleLabelArray addObject:label];
       }
       
       // 當(dāng)前索引數(shù)字
       [self addSubview:self.indicatorLabel];
       }
       return self;
      }
      
      // 布局更新頁(yè)面元素
      - (void)layoutSubviews {
       NSInteger perWidth = self.frame.size.width / self.titlesArray.count;
       
       // 進(jìn)度條
       self.progressView.frame = CGRectMake(0, 0, self.frame.size.width - perWidth, 1);
       self.progressView.center = CGPointMake(self.frame.size.width / 2, self.frame.size.height / 4);
       
       CGFloat startX = self.progressView.frame.origin.x;
       for (int i = 0; i < self.titlesArray.count; i++) {
       // 圓圈
       UIView *cycle = self.circleViewArray[i];
       if (cycle) {
        cycle.center = CGPointMake(i * perWidth + startX, self.progressView.center.y);
       }
       
       // 標(biāo)題
       UILabel *label = self.titleLabelArray[i];
       if (label) {
        label.frame = CGRectMake(perWidth * i, self.frame.size.height / 2, self.frame.size.width / self.titlesArray.count, self.frame.size.height / 2 );
       }
       }
       self.stepIndex = self.stepIndex;
      }
      
      #pragma mark - Custom Accessors
      
      - (UIProgressView *)progressView {
       if (!_progressView) {
       _progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
       _progressView.progressTintColor = TINT_COLOR;
       _progressView.progress = self.stepIndex / ((self.titlesArray.count - 1) * 1.0);
       }
       return _progressView;
      }
      
      - (UILabel *)indicatorLabel {
       if (!_indicatorLabel) {
       _indicatorLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 23, 23)];
       _indicatorLabel.textColor = TINT_COLOR;
       _indicatorLabel.textAlignment = NSTextAlignmentCenter;
       _indicatorLabel.backgroundColor = [UIColor whiteColor];
       _indicatorLabel.layer.cornerRadius = 23.0f / 2;
       _indicatorLabel.layer.borderColor = [TINT_COLOR CGColor];
       _indicatorLabel.layer.borderWidth = 1;
       _indicatorLabel.layer.masksToBounds = YES;
       }
       return _indicatorLabel;
      }
      
      - (NSMutableArray *)circleViewArray {
       if (!_circleViewArray) {
       _circleViewArray = [[NSMutableArray alloc] initWithCapacity:self.titlesArray.count];
       }
       return _circleViewArray;
      }
      
      - (NSMutableArray *)titleLabelArray {
       if (!_titleLabelArray) {
       _titleLabelArray = [[NSMutableArray alloc] initWithCapacity:self.titlesArray.count];
       }
       return _titleLabelArray;
      }
      
      // 設(shè)置當(dāng)前進(jìn)度索引,更新圓形圖片、文本顏色、當(dāng)前索引數(shù)字
      - (void)setStepIndex:(NSUInteger)stepIndex {
       for (int i = 0; i < self.titlesArray.count; i++) {
       UIView *cycle = self.circleViewArray[i];
       UILabel *label = self.titleLabelArray[i];
       if (stepIndex >= i) {
        cycle.backgroundColor = TINT_COLOR;
        label.textColor = TINT_COLOR;
       } else {
        cycle.backgroundColor = [UIColor lightGrayColor];
        label.textColor = [UIColor lightGrayColor];
       }
       }
      }
      
      #pragma mark - Public
      
      - (void)setStepIndex:(NSUInteger)stepIndex animation:(BOOL)animation {
       if (stepIndex < self.titlesArray.count) {
       // 更新顏色
       self.stepIndex = stepIndex;
       // 設(shè)置進(jìn)度條
       [self.progressView setProgress:stepIndex / ((self.titlesArray.count - 1) * 1.0) animated:animation];
       // 設(shè)置當(dāng)前索引數(shù)字
       self.indicatorLabel.text = [NSString stringWithFormat:@"%lu", stepIndex + 1];
       self.indicatorLabel.center = ((UIView *)[self.circleViewArray objectAtIndex:stepIndex]).center;
       }
      }
      
      @end

      接口調(diào)用:

      - (void)viewDidLoad {
       [super viewDidLoad];
       
       // 初始化
       _hqlStepView = [[HQLStepView alloc] initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, 60) titlesArray:@[@"第一步", @"第二步", @"第三步"] stepIndex:0];
       [self.view addSubview:_hqlStepView];
      }
      
      - (void)viewDidAppear:(BOOL)animated {
       [super viewDidAppear:animated];
       
       // 設(shè)置當(dāng)前步驟,步驟索引=數(shù)組索引
       [_hqlStepView setStepIndex:0 animation:YES];
      }

      看完上述內(nèi)容,你們對(duì)怎么在iOS中實(shí)現(xiàn)步驟進(jìn)度條功能有進(jìn)一步的了解嗎?如果還想了解更多知識(shí)或者相關(guān)內(nèi)容,請(qǐng)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司行業(yè)資訊頻道,感謝大家的支持。

      另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)建站www.cdcxhl.com,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。


      分享名稱:怎么在iOS中實(shí)現(xiàn)步驟進(jìn)度條功能-創(chuàng)新互聯(lián)
      當(dāng)前網(wǎng)址:http://ef60e0e.cn/article/dohscd.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>

        邮箱| 屏东县| 湘西| 嘉峪关市| 安仁县| 岳阳县| 梅州市| 霍山县| 南皮县| 东乌珠穆沁旗| 东至县| 新闻| 华容县| 偃师市| 穆棱市| 嘉定区| 余庆县| 岱山县| 辛集市| 乌兰察布市| 嘉峪关市| 霍邱县| 恩平市| 贺兰县| 霸州市| 宜兰县| 庆阳市| 赞皇县| 庆元县| 盈江县| 铁岭市| 乌审旗| 韶关市| 长岭县| 永善县| 富川| 平潭县| 玛纳斯县| 二连浩特市| 亳州市| 东兰县|