iOS上是否可以有从右到左的进度条? [英] Is a Right-to-Left progress bar possible on iOS?

查看:582
本文介绍了iOS上是否可以有从右到左的进度条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已尝试发送 [UIProgressView setProgress] 负值,但无效。



解决方案

您可以尝试设置< a href =http://developer.apple.com/library/ios/#documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instp/UIView/transform> <$ c $将 UIProgressView 的c> transform 属性转换为旋转的新 CGAffineTransform 视图180度并垂直翻转(保留shininess)(参见 CGAffineTransformMake() CGAffineTransformRotate()

  UIProgressView * pv = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar]; 
pv.frame = CGRectMake(10,100,300,11);
CGAffineTransform transform = CGAffineTransformMake(1,0,0,-1,0,pv.frame.size.height); //垂直翻转视图
transform = CGAffineTransformRotate(transform,M_PI); //旋转角度以弧度表示
pv.transform = transform;
pv.progress = 0.5;


I've tried sending [UIProgressView setProgress] negative values, and that doesn't work.

Is there some other way to get a progress bar that fills from the right-hand end?

解决方案

You could try setting the transform property of your UIProgressView to a new CGAffineTransform that rotates the view by 180 degrees and flips it vertically (to preserve the "shininess") (see CGAffineTransformMake() and CGAffineTransformRotate()).

Something along the lines of:

UIProgressView *pv = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar];
pv.frame = CGRectMake(10, 100, 300, 11);
CGAffineTransform transform = CGAffineTransformMake(1, 0, 0, -1, 0, pv.frame.size.height); // Flip view vertically
transform = CGAffineTransformRotate(transform, M_PI); //Rotation angle is in radians
pv.transform = transform;
pv.progress = 0.5;

这篇关于iOS上是否可以有从右到左的进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆