在timerBar.bounds.size.width赋值中出现错误“表达式不可分配”

时间:2014-10-17 10:14:30

标签: ios

我正在尝试创建一个计时器栏,但我收到错误"表达式不可分配"在timerBar.bounds.size.width = 0

(void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

self.view.backgroundColor = [UIColor blueColor];  

timerBar = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH , 5)];
timerBar.backgroundColor = [UIColor whiteColor];
[self.view addSubview:timerBar];

[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
    timerBar.bounds.size.width = 0;
} completion:^(BOOL finished) {

}];

}

我做错了什么?为什么不能分配值?

1 个答案:

答案 0 :(得分:1)

您不能将设置的边界宽度指向零!

CGFloat width = 0;
timerBar.bounds = CGRectMake(0, 0, width , 5)
相关问题