[英]AVCaptureVideoDataOutput and Image display size on the screen
[英]iOS: First screen display image
對於我的手機應用程序,我想在3秒內在第一個屏幕上顯示一個圖像,並切換到主菜單而無需用戶操作。
如何執行速度並自動切換視圖?
謝謝。
用這個
[self performSelector:@selector(loadMainView) withObject:nil afterDelay:3.0];
使用loadMainView
方法,您應該開始設置您的常用視圖
您要做的事情稱為啟動畫面,請參閱應用程序啟動(默認)圖像或參閱本指南
我通常通過創建一個視圖控制器來實現這一點,該視圖控制器在其視圖中具有帶有啟動圖像的UIImageView。
您可以通過這種方式將它作為模式視圖控制器呈現在rootViewController之上。 在AppDelegate的application:didFinishLaunchingWithOptions:
通過調用顯示模態
// rootViewController is the view controller attached to the UIWindow
[rootViewController presentViewController:imageViewController animated:NO completion:nil];
在imageViewController中你可以這樣做:
- (void)dismiss {
// You can animate it or not, depending on your needs
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
}
- (void)viewDidApper {
[self performSelector:@selector(dismiss) withObject:nil afterDelay:AMOUNT_OF_TIME];
}
一種不涉及模態的類似方法是在UINavigationController中推送此視圖控制器(如果使用它)
在AppDelegate的application:didFinishLaunchingWithOptions:
你必須用這樣的東西設置導航控制器的第一個控制器
UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController:imageViewController];
self.window.rootViewController = navController;
[self.window makeKeyAndVisible];
在imageViewController中你可以這樣做:
- (void)dismiss {
// Here you should init your nextViewController, the real "home" of the app
....
// Then you can present it. You can animate it or not, depending on your needs.
// I prefer to replace the whole stack, since user shouldn't go back to the image screen.
[self.navigationController setViewControllers:@[nextViewController] animated:YES];
}
- (void)viewDidApper {
[self performSelector:@selector(dismiss) withObject:nil afterDelay:AMOUNT_OF_TIME];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.