1
點擊按鈕後,我想要一個UIView
向下滑動約50%
的屏幕。幻燈片應該是動畫的。以下是我迄今爲止嘗試:用動畫滑動UIView
- (IBAction)moveDownButtonClicked:(id)sender {
_sliderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width
, [[UIScreen mainScreen] bounds].size.height*0.5)];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
_sliderView.frame = CGRectMake(0,0,320,20);
[UIView commitAnimations];
}
當你運行該代碼時會發生什麼? – stone
沒有任何反應。不動畫 – Illep
我想你忘了添加[self.view添加子視圖:_sliderView] –