Modal模式跳转相关

本文介绍了如何在iOS应用中处理页面旋转,并详细讲述了6.0之前使用Modal方法进行页面跳转的步骤,同时提及了页面跳转动画效果的设置方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.页面旋转

现在想要设置当前控制器view支持不支持旋转,需要设置两个相关方法。

<span style="font-size:18px;">-(BOOL)shouldAutorotate
{
    return YES;
}</span>

第一个方法如上,决定当前页面是否支持旋转功能。

<span style="font-size:18px;">-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortrait;
}</span>

第二个方法如上,决定当前页面支持几种旋转功能


2.Model方法跳转页面

6.0之前使用

<span style="font-size:18px;">- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0);</span>
6.0之后开始使用新的方法

<span style="font-size:18px;">UIStoryboard *board = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
UIViewController *deVc = [board instantiateViewControllerWithIdentifier:@"ViewController"];
[self presentViewController:deVc animated:YES completion:^{
NSLog(@"success");
</span>

关于页面跳转时的动画效果,需要在前往页面中设置

<span style="font-size:18px;">[self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];渐变</span>
<span style="font-size:18px;">[self setModalTransitionStyle:UIModalTransitionStyle<span style="font-family: Arial, Helvetica, sans-serif;">];翻转</span></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size:18px;">[self setModalTransitionStyle:UIModalTransitionStylePartialCurl];翻半页</span></span>
<span style="font-size:18px;">[self setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; 底部向上默认画面</span>







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值