- (IBAction)createEntrybutton:(ID)sender { CreateEntryVIEwController *vc2 = [[CreateEntryVIEwController alloc] init]; [self presentVIEwController:vc2 animated:TRUE completion:nil];}
然而,根据我的UI,这个动画从底部带来了vc2,这似乎是违反直觉的.所以我的问题是:
如何使用presentVIEwController从右侧而不是底部显示我的vc2?
谢谢.
解决方法 最干净的是使用navigationController来推送和d出视图.如果您已经在NavigationController中
[self.navigationCtroller pushVIEwController:vc2 animated:TRUE completion:nil]
如果不是,请调整视图控制器添加到窗口的代码.如果您的VC是rootwindowController并且您没有使用故事板,那么这可能在您的AppDelegate中
如果您使用故事板,请调整故事板,以便您进入导航控制器
ELSE如果你因为任何原因不想这样::)只需使用[UIVIEw animate:vc2.vIEw ….]在2. VC的视图中手动设置动画.
内联编写 – 方法名称不匹配但显示一般方法:
UIVIEw *v = vc2.vIEw;CGRect f = v.frame;f.origin.x += self.vIEw.frame.size.wIDth; //move to rightv.frame = f;[UIVIEw animateWithDuration:0.5 animations:^{ v.frame = self.vIEw.frame;} completion:^(BOol finished) { [self presentVIEwController:vc2 animated:NO completion:nil];}];
在完成块中呈现视图控制器vc2非动画,就像你自己已经做过的那样
总结以上是内存溢出为你收集整理的ios – 来自侧面的presentViewController动画全部内容,希望文章能够帮你解决ios – 来自侧面的presentViewController动画所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)