你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> IOS開發(20)之UIProgressView控件

IOS開發(20)之UIProgressView控件

編輯:IOS開發綜合

1 前言
UIProgressView控件用來顯示進度條描述某個任務的進度。

2 代碼實例
ZYViewController.h:


[plain] view plaincopyprint?#import <UIKit/UIKit.h> 
 
@interface ZYViewController : UIViewController 
 
@property(nonatomic,strong) UIProgressView *progressView; 
 
@end 

#import <UIKit/UIKit.h>

@interface ZYViewController : UIViewController

@property(nonatomic,strong) UIProgressView *progressView;

@end
ZYViewController.m:


[plain]
@synthesize progressView; 
 
- (void)viewDidLoad 

    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
    self.view.backgroundColor = [UIColor whiteColor]; 
    self.progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];//初始化條狀進度條 
    self.progressView.center = self.view.center; 
    self.progressView.progress = 0.5f;//設置進度條進度為50% 
    [self.view addSubview:self.progressView]; 

@synthesize progressView;

- (void)viewDidLoad
{
    [super viewDidLoad];
 // Do any additional setup after loading the view, typically from a nib.
    self.view.backgroundColor = [UIColor whiteColor];
    self.progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];//初始化條狀進度條
    self.progressView.center = self.view.center;
    self.progressView.progress = 0.5f;//設置進度條進度為50%
    [self.view addSubview:self.progressView];
}
運行結果:

 

 

\
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved