IOS基礎-UIProgressView

來源:互聯網
上載者:User

IOS基礎-UIProgressView

UIProgressView和UIActivityIndicator有些類似

 

但是不同之處在於,

UIProgressView能夠更加精確的反應進度

UIActivityIndicator則只能表示事物在進行中

 

有一個例子是在Mail程式中當在下載資訊的時候,有一個UIProgressView顯示在底部

 

- (void)viewDidLoad{    [super viewDidLoad];        //定義一個進度條    UIProgressView *progressV = [[UIProgressView alloc] init];        progressV.frame = CGRectMake(100, 100, 2, 300);        //進度值    progressV.progress = 0.1;        /*     typedef NS_ENUM(NSInteger, UIProgressViewStyle) {     UIProgressViewStyleDefault,     // 預設狀態     UIProgressViewStyleBar,         // 一般用於toolbar     };     */    progressV.progressViewStyle = UIProgressViewStyleDefault;        // 設定填充部分的顏色(假設進度到30%, 那30%的顏色就是這個屬性)    progressV.progressTintColor = [UIColor greenColor];    // 設定未填充部分的顏色(假設進度到30%, 那70%的顏色就是這個屬性)    progressV.trackTintColor = [UIColor redColor];    // 設定填充部分的圖片 設定圖片後progressTintColor無效    progressV.progressImage = [UIImage imageNamed:@"1"];    // 設定未填充部分的圖片 設定圖片後trackTintColor無效    progressV.trackImage = [UIImage imageNamed:@"2"];        [self.view addSubview:progressV];}//關鍵progress屬性當前進度值,並且設定是否需要動畫- (void)setProgress:(float)progress animated:(BOOL)animated{}


 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.