iOS上是否可以有从右到左的进度条? [英] Is a Right-to-Left progress bar possible on 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()$ c $
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屋!