动画子视图
我的 iPad 应用程序中有一个分割视图控制器,其中详细视图具有 UITableView 的子视图。 我试图实现的功能是当按下子视图上的按钮(信息按钮)时,在子视图的同一位置获取信息视图。我需要通过动画获取此信息视图,该动画是当按下信息按钮时,该子视图将单独翻转(UIAnimationOptionFlipFromRight)并且信息视图将显示...
这就是尝试实现它的方法 -
-(void) showInfoView: (id)sender
{
infoView = [[InfoViewController alloc] initWithNibName:@"ViewViewController" bundle:nil];
infoView.view.frame = CGRectMake(250, 300, 200, 200);
[UIView transitionWithView:self.view duration:1
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^{
[self.view addSubview:infoView.view];
}
completion:nil];
}
当我运行模拟器并按任何子视图上的信息按钮,所发生的情况是动画完美地发生,即子视图从右侧翻转但 infoView 没有显示。
如果有人能告诉我我哪里出错了,那就太好了。
I have a split view controller in my Ipad app, in which the detail view has subviews which are UITableView's.
The functionality I am trying to implement is to get an info view at the same position of a subview when a button(info button) on the subview is pressed. I need to get this info view by animation and that animation is that when the info button is pressed, that subview alone would flip (UIAnimationOptionFlipFromRight) and the info view would show...
This is how try to implement it -
-(void) showInfoView: (id)sender
{
infoView = [[InfoViewController alloc] initWithNibName:@"ViewViewController" bundle:nil];
infoView.view.frame = CGRectMake(250, 300, 200, 200);
[UIView transitionWithView:self.view duration:1
options:UIViewAnimationOptionTransitionFlipFromRight
animations:^{
[self.view addSubview:infoView.view];
}
completion:nil];
}
When I run the simulator and press the info button on any subview, what happens is that the animation happens perfectly, i.e. the subview flips from the right but the infoView is not getting displayed.
It would be great if someone could tell me where I am going wrong here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在屏幕上执行动画的基本步骤如下:
您似乎正在跳过第 3 步,甚至可能跳过第 2 步。
The basic steps of performing an animation to onscreen is as follows:
It seems like you're skipping step 3 and possibly step 2.
您是否尝试将子视图框架设置为超级视图的框架,即
Did you try setting the subview frame to the frame of your superview, i.e