1

I am experience a rendering bug when using the default progress view. Rather than being 9px tall, the view is clipped to about 4px when using the default progress view. My app is built with the iOS6 SDK, and the issue appear when running on a iOS7 device. The interface is built with interface builder.

Is there a simple fix for this issue? Switching the style from "Default" to "Bar" in interface builder fixes the problem, but that changes the appearance.

enter image description here

4

3 回答 3

10

在代码中设置框架帮助我解决了这个问题。

于 2013-09-19T05:15:09.403 回答
1

@iPP 的答案不是最好的。在代码中设置框架会导致您的代码充满 iOS 版本检查,并且当支持多个设备方向时,该代码往往会变得非常复杂。

我认为最好的方法是在 Xcode 5 中使用新功能“iOS 6/7 Deltas”。看看这里

而“iOS 6/7 Deltas”的关键用法是:

当 Auto Layout 关闭时,您会注意到 Interface Builder 实用程序区域(右窗格)的大小选项卡中的一个区域,允许您设置 iOS 6/7 Deltas。可以为每个视图单独设置增量,并按照您的预期工作。如果您的故事板或笔尖设置为在 iOS 6 中查看,那么设置增量将导致该视图在 iOS 7 中运行时按照设置的增量量移动和/或调整大小。或者,如果您的情节提要或笔尖设置为查看在 iOS 7 中,则在 iOS 6 中运行时将应用增量。这两个工具都可以帮助您支持旧版本的 iOS 和 iOS 7

对于UIProgressView,这里你可以尝试将“delta Y”设置为-7px,因为iOS 7只是将UIProgressView的Y原点减少了7px,所以在iOS7中运行时,我们应该把它还给7px。

于 2013-11-26T02:24:48.497 回答
0

这就像 iOS7 的进度视图使用 iOS7 Style 的框架一样。你有两种方法。1.设置进度视图样式---bar,可以在nib文件或者代码中进行。2.使用代码设置框架。类似于:progressView.frame = CGRectMake(x,y,w,h);

当您旋转或更改布局时,第二个将面临布局问题。所以最简单的方法是设置进度视图的样式。

于 2013-10-12T08:09:45.253 回答