2014-10-17 19 views
0

我試圖創建一個timerbar,但我得到一個錯誤「表達式是不可轉讓」的timerBar.bounds.size.width = 0錯誤「的表達是不可轉讓」的timerBar.bounds.size.width分配

(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) { 

}]; 

} 

我究竟做錯了什麼?爲什麼不能分配這個值?

+0

我已經添加了一個實際問題並清理了您的佈局。下次請自己做。 – 2014-10-17 10:31:02

回答

1

你不能直接設置邊界寬度爲零!

CGFloat width = 0; 
timerBar.bounds = CGRectMake(0, 0, width , 5) 
相關問題