Вопрос

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

Это было полезно?

Решение

Setting the frame in code helped me solve this.

Другие советы

@iPP 's answer is not the best. Setting the frame in code will cause your code to be riddled with iOS version checks, and that code tends to get very complicated when supporting multiple device orientations.

I think the best way is to use new feature "iOS 6/7 Deltas" in Xcode 5.have a look here

And "iOS 6/7 Deltas" key usage is:

When Auto Layout is turned off, you will notice an area in the sizing tab of the utility area (right pane) of Interface Builder that allows you to set iOS 6/7 Deltas. Deltas can be set individually for each view and work as you would expect. If your storyboard or nib is set to view as iOS 6, then setting the deltas will cause that view to be shifted and/or resized by the set delta amount when run in iOS 7. Alternately, if your storyboard or nib is set to view in iOS 7, then the deltas will be applied when run in iOS 6. Both of these tools help you to support older versions of iOS alongside iOS 7

for UIProgressView, here you can try to set "delta Y" to be -7px, because iOS 7 just reduce the Y origin of UIProgressView by 7 px, so when running in iOS7, we should give it back the 7px.

It's like the iOS7 cut the progress view use the iOS7 Style's frame. You have two ways. 1. set the progress view style ---bar, you can do this in the nib file or code. 2. use the code to set the frame. Something like: progressView.frame = CGRectMake(x,y,w,h);

The second will face the layout issue when you rotate or change the layout. So the easiest way is set the progress view's style.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top