IOS 頁面間跳轉,ios頁面間跳轉

來源:互聯網
上載者:User

IOS 頁面間跳轉,ios頁面間跳轉

常用的就兩種 一種通過導航,一種直接跳

第一種 直接跳轉 思路大致就是new一個目的頁面,然後設定下頁面跳轉動畫 中間還可以做點目的頁面的資料初始化:

ValueInputView *valueView = [[ValueInputView alloc] initWithNibName:@"ValueInputView"bundle:[NSBundle mainBundle]];

    valueView.delegate = self;

    [valueView setModalTransitionStyle:UIModalTransitionStyleCoverVertical];

    [self presentModalViewController:valueView animated:YES];

//返回 

[self dismissModalViewControllerAnimated:YES];

第二:

利用UINavigationController,調用pushViewController,進行跳轉;這種採用壓棧和出棧的方式,進行Controller的管理。調用popViewControllerAnimated方法可以返回

PickImageViewController *ickImageViewController = [[PickImageViewController alloc] init]; 

[self.navigationController pushViewController: ickImageViewController animated:true]; 

四種setModalTransitionStyle風格

UIModalTransitionStyleCoverVertical 從底部滑入UIModalTransitionStyleFlipHorizontal,水平翻轉進入UIModalTransitionStyleCrossDissolve,交叉溶解UIModalTransitionStylePartialCurl,翻頁

 

情境切換

多個情境之間切換的樣式(Style)總共有5個:
Modal(模態) -- 過渡到另一個情境,以完成一項任務。任務完成後,將關閉該情境,並返回到原來的情境。
Push(壓入) -- 建立一個情境鏈,使用者可在其中前後移動。用於導航視圖控制器。
Replace(替換,僅適用於iPad) -- 替換當前情境,用於一些iPad特有的視圖控制器。
Popover(彈出框,僅適用於iPad) -- 一個帶箭頭的彈出框。
Custome(自訂) -- 通過編譯在情境之間進行自訂過渡。

過渡類型(Transition)是從一個情境切換到另一個情境時播放的動畫。有4個選項:
Cover Vertical -- 新情境從下向上移動,逐漸覆蓋舊情境。
Flip Horizontal -- 視圖水平翻轉,以顯示背面的新情境。
Cross Dissolve -- 舊情境淡出,新情境淡入。
Partial Curl -- 舊情境像書頁一樣翻開,顯示下面的新情境。

在iPad應用程式中,還會多出一個Presentation屬性,它決定了模態視圖在螢幕上的顯示方式。有4種顯示樣式:
Form Sheet(表單) -- 將情境調整到比螢幕小(不管朝向),並在當前情境後面顯示原始情境,這幾乎相當於在一個iPad視窗中顯示。
Page Sheet(頁面) -- 調整情境大小,使其以縱向格式顯示。
Full Screen(全屏) -- 調整情境大小,使其覆蓋整個螢幕。
Current Context(當前上下文) -- 以原始情境的顯示方式展示情境。


ios兩個xib頁面之間跳轉

你搞定了嗎,我也在想這個呢
 
ios開發:怎實現點擊一個按鈕,跳轉到一個新的介面,急阿,~~~

1.可以使用導航控制器棧。將當前視圖控制器作為rootViewController.需要在建立當前控制器的代碼中這樣來建立
UIViewController *vc1=[[UIViewControlelr alloc] init];
UINavigationController *navController =[[UINavigationController alloc] initWithRootViewController:vc1];
[vc1 release];
[window addSubView:navController.view];
[navController release];

只有噹噹前控制器在導航控制器棧中才可以使用pushViewController來導航其它視圖
導航到新的視圖控制器:
UIViewController *vc2=[[ViewController alloc] init];
[self.navigationController pushViewController:vc2 animated:YES];
[vc2 release];
2.模態視圖
UIViewController *vc2=[[ViewController alloc] init];

[self presentModalViewController:controller animated:YES];
[vc2 release];

3.使用新的視圖覆蓋當前視圖
如果使用這種方式,建議建立一個可維護控制器之間互動的控制器swithController,在這個控制器中來實現不同控制器之間的視圖切換
@inertface SwitchViewController:UIViewController
@property(retain) UIViewController *vc1
@property (retain) UIViewController *vc2;

-(void)showVC1;
-(void)showVC2;
@end

@implementation SwitchViewController
@synthesize vc1,vc2;

-(void)showVC1 {
if (vc2) {
[vc2.view removeFromSuperView];
}

[self.view addSubView:vc1.view];
}
@end
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.