English 中文(简体)
为什么UIProgressview进步棒不能恢复?
原标题:Why isn t UIProgressview progress bar resizable?

有关此处的“UI VisptionOview:

我尝试了实施戴夫·德隆所说的话,我做了他以他为例所展示的一切,但是当我运行这个程序时,如果我尝试改变进步的价值,我的进度栏就会变成一个拉长的图象。轨道图象无论如何完美地调整和在轨道上重复。出于某种原因,进展并不是在进步栏上完成的。

UIImage * load = [[UIImage imagedNamed:@"load.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 1, 0, 1)];
UIImage * track = [[UIImage imageNamed:@"track.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 1, 0, 1)]; 
[progressbar progressImage:load];
[progressbar trackImage:track];
[progressbar setProgress:0.5];

 原件图像和进度栏结果

我尝试把我的图像变量从进度图像转换为跟踪图像,看看是否是无法调整的图像(因为图像是完全相同的图像,颜色不同,所以不应该如此 ) 。 除了我这样做的时候,跟踪图像再次完美地调整了大小,而进步图像则被拉长了。有人知道为什么会发生这种情况吗?

最佳回答

您的可变上限设置可能不应该是 。 在您的情况中, 看起来应该是 , 或者 UIEdgeInstsetsZero

我剪出了红色和蓝色的小方块:

蓝色 red

...然后扔进一个 UIProgressView :

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

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

当使用0.5的 process < progress 对UI进行进度视图时,我得到以下信息:

"https://i.sstatic.net/JnT7X.png" alt="进展视图"/ >

看上去不错

问题回答

暂无回答




相关问题
How to change out-of-focus text selection color in Xcode?

Okay, I ll bite. I ve got really pleasant code/window colors set up in Xcode. Ordinarily, my selection color is very visible. When I am doing a project search and iterating through the results, ...

Iphone NSTimer Issue

Hi I am new to objective c. I am trying to make an app for iphone. I have a button on my view, and the click on which the function playSound is called. This is working properly. It does plays the ...

Include a .txt file in a .h in C++?

I have a number of places where I need to re-use some template code. Many classes need these items In a .h could I do something like: #include <xxx.txt> and place all of this code in the ....

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Xcode open two editor windows with same file

Is it possible to open the same file in two separate windows in Xcode. I can open a file in one window and the same file in the main Xcode editor window, but I wanted two separate fulltime editor ...

Forcing code signing refresh in Xcode

In our environment, we share resources across multiple projects and platforms. When building for iPhone, only a subset of those resources are needed. Since that subset is still considerable, we have ...

热门标签