[英]click on UIbutton then open new UIviewController in top to down like pull down
(IBAction)btnClick:(id)sender
{
secondView *sc= [self.storyboard instantiateViewControllerWithIdentifier:@"secondView"];
[self.navigationController pushViewController:sc animated:YES];
}
You should achieve different navigation style using below code, Hope this will be help for you. 您应该使用以下代码实现不同的导航样式,希望这对您有所帮助。
UIViewController * secondView = [self.storyboard instantiateViewControllerWithIdentifier:@"secondView"];
CATransition* transition = [CATransition animation];
transition.duration = 0.5;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade; //kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
//transition.subtype = kCATransitionFromTop; //kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:secondView animated:NO];
Happy Coding! 编码愉快!
For View Animation: 对于View动画:
For animation from Bottom to Top add below 对于从下到上的动画,请在下面添加
[UIView animateWithDuration:0.5
delay:0.1
options: UIViewAnimationCurveEaseIn
animations:^{
self.postStatusView.frame = CGRectMake(0, 0, 320, 460);
}
completion:^(BOOL finished){
}];
[self.view addSubview:self.postStatusView];
try with like this 尝试这样
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
DetailViewController *eventDetailsViewController = [storyboard instantiateViewControllerWithIdentifier:@"DetailViewController"];
eventDetailsViewController.view.frame= CGRectMake(0, -self.view.bounds.size.height, self.view.bounds.size.width, self.view.bounds.size.height);
eventDetailsViewController.view.backgroundColor = [UIColor redColor];
[UIView animateWithDuration:1.5 delay:0.f options:UIViewAnimationOptionCurveEaseInOut animations:^{
[eventDetailsViewController.view setFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
} completion:^(BOOL finished){
}];
[self.view addSubview:eventDetailsViewController.view];
[self addChildViewController:eventDetailsViewController];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.