是否可以在显示之前设置视图的边界
-(void)CallingView2{
SettingsViewController *aSettingsView = [[SettingsViewController alloc] initWithNibName:@"Settings" bundle:nil];
[self setSettingsViewController:aSettingsView];
[aSettingsView release];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
//setting the animation
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
[self.window addSubview:[settingsViewController view]];
**[[settingsViewController view] setBounds:CGRectMake(0, -30, 320, 480)];**
[UIView commitAnimations];}
我已将代码放在提交动画的代码中的星星之间,它可以正常工作,它可以按应有的方式移动视图,但现在的问题是,当我旋转到视图时,我可以看到视图何时向下移动。 是否可以在显示之前设置视图的边界,以便用户每次进入设置时都看不到它何时向下移动 30px
-(void)CallingView2{
SettingsViewController *aSettingsView = [[SettingsViewController alloc] initWithNibName:@"Settings" bundle:nil];
[self setSettingsViewController:aSettingsView];
[aSettingsView release];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
//setting the animation
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
[self.window addSubview:[settingsViewController view]];
**[[settingsViewController view] setBounds:CGRectMake(0, -30, 320, 480)];**
[UIView commitAnimations];}
I have put the code between the stars in the code where I commit my animation and it works, it moves the view as it should but now the problem is that when i rotate to the view i can see when the view is moving down.
Is it possible to set bounds for the view before it is shown so the user cant see when it is moving 30px down every time he go to settings
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题是您正在动画块内设置视图边界。在执行翻转过渡期间,视图原点将从 (0,0) 动画到 (0,-30)。
在视图控制器的 viewDidLoad 中设置视图几何形状将是更好的方法。
Your problem is that you're setting the view bounds within an animation block. The view origin will animate from (0,0) to (0,-30) during the time it takes to perform the flip transition.
Setting your view geometry in the view controller's viewDidLoad would be a better approach.