如何通过addMubview获取UIView转换,就像presentModalViewController一样?可用的动画似乎没有这样做。
我会使用模态,但我在顶部有一个导航栏,不想禁用它。此外,导航栏上的模态覆盖。如果有办法让模态不会禁用导航栏,我可以采用这种方法。但由于它是一种模态,我认为这是不可能的。
答案 0 :(得分:3)
推动具有相同导航状态的模态视图控制器似乎会破坏由导航控制器建模的堆栈隐喻,这很奇怪,但我会假设你已经考虑过了。
如果您只想添加一个从屏幕底部开始动画的子视图,您可以这样做:
CGRect onScreenFrame = viewToAdd.frame;
CGRect offScreenFrame = onScreenFrame;
offScreenFrame.origin.y = self.view.bounds.size.height;
viewToAdd.frame = offScreenFrame;
[UIView beginAnimations:@"FakeModalTransition" context:nil];
[UIView setAnimationDuration:0.5f];
[self.view addSubview:viewToAdd];
viewToAdd.frame = onScreenFrame;
[UIView commitAnimations];
答案 1 :(得分:0)
如果您使用presentModalViewController
任意UIViewController
作为参数,那么您可以使用@property(nonatomic, readonly, retain) UINavigationItem *navigationItem
,并且可以使用它复制或创建导航栏。