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

Fogmeister
  • 76,236
  • 42
  • 207
  • 306
jcampbell1
  • 4,159
  • 3
  • 33
  • 35

3 Answers3

10

Setting the frame in code helped me solve this.

iPP
  • 441
  • 1
  • 7
  • 12
  • 6
    Just ran into this problem on iOS7 and I am programmatically creating my custom looking progress view. I want to point out that the developer should set the UIProgressView's frame AFTER setting the track and fill images for the progress view. So something like progressView.trackImage = ... ; and progressView.progressImage = ... ; then progressView.frame = CGRectMake(.....); – Zhang Oct 16 '13 at 03:29
  • 1
    Setting the frame doesn't seem to work if progress bar is styled using `progressTintColor` and `trackTintColor` instead of `progressImage` and `trackImage`. – kolufild Nov 20 '13 at 12:21
1

@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.

jianpx
  • 3,190
  • 1
  • 30
  • 26
0

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.