我对Xcode很陌生。
我需要一个If语句来询问UIProgressView进度(浮动)是变大还是变小,然后做一些事情。
谢谢你的帮助。
if (myProgV is moving) {
//Do something
}发布于 2014-03-12 19:48:27
正如其他人所暗示的,你已经把这个倒过来了。进度视图是视图对象。它展示的东西。它不应该保存状态信息。
您应该了解MVC设计模式。视图对象不应用于存储事物。
我建议在视图控制器中添加一个属性。我们称之为进步。假设它的值从0到1不等。
为进度属性实现自定义设置器,该属性设置进度视图,并将值保存到属性的实例变量:
- (void) setProgress: (CGFloat) progress;
{
_progress = progress;
[myProgressView setProgress: progress animated: yes];
//Do anything else here that you need to to respond to a change in progress.
}现在,由于您有一个属性,您还可以在任何时候查询进度的值:
if (self.progreess > .5)
NSLog(@"More than halfway done!");https://stackoverflow.com/questions/22362097
复制相似问题