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] –