Why isn't UIProgressview progress bar resizable?

纵然是瞬间 提交于 2019-12-03 21:37:19

Your resizable cap insets probably shouldn't be {0,1,0,1}. In your case, it looks like they should be {0,0,0,0}, or UIEdgeInsetsZero.

I clipped out the little red and blue squares:

... and then threw them into a UIProgressView:

UIImage *red = [[UIImage imageNamed:@"red"] resizableImageWithCapInsets:UIEdgeInsetsZero];
UIImage *blue = [[UIImage imageNamed:@"blue"] resizableImageWithCapInsets:UIEdgeInsetsZero];

[pv setTrackImage:blue];
[pv setProgressImage:red];

When the progress view was placed on the UI with a progress of 0.5, I got this:

Looks good to me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!