iPhone ProgressBar

前端 未结 3 1918
旧巷少年郎
旧巷少年郎 2021-02-03 16:19

How can I change the color as well as size of UIProgressBar in iPhone SDK

3条回答
  •  广开言路
    2021-02-03 16:53

    Assuming you mean a UIProgressView, you can resize it as you would any other view, by setting the frame:

    UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
    [progressView setFrame:CGRectMake(0,0,320,10)];
    

    or if you're using the default style, you can set the frame in the init method:

    UIProgressView *progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(0,0,320,10)];
    

    As far as I know, the color of a UIProgressView cannot be changed. You'll probably have to roll your own view for that.

提交回复
热议问题