2017-04-07 3 views
-1

imageimageView에 넣고 LaunchStoreyboard에 넣습니다. 어떻게 프로그램의 시간을 프로그램 적으로 지연시킬 수 있습니까? 어떤 도움이 높게 평가 될 것입니다. 여기 신속한 Xcode iOS에서 스플래시 시작 화면을 프로그래밍 방식으로 지연시킬 수있는 방법

다음은 Launch Screen Guideline from Apple

입니다 시작 화면보기 컨트롤러 코드가

import UIKit 
class LaunshViewController: UIViewController { 

override func viewDidLoad() { 
    super.viewDidLoad() 
self.delay(0.4) 
} 


func delay(_ delay:Double, closure:@escaping()->()) { 
    let when = DispatchTime.now() + delay 
    DispatchQueue.main.asyncAfter(deadline: when, execute: closure) 
} 

override func didReceiveMemoryWarning() { 
    super.didReceiveMemoryWarning() 
    // Dispose of any resources that can be recreated. 
} 
} 
+0

가능한 중복 (http://stackoverflow.com/questions/35028449/ios-how-to-delay- the-launch-screen) –

+0

제 질문은 Swift 3입니다.하지만 Obj-C의 @OlegGordiichuk –

+4

접근법을 제안했습니다. 구현 방법은 프로그래밍 언어에 의존하지 않아도 적합합니다. –

답변

12

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
     Thread.sleep(forTimeInterval: 3.0) 
     // Override point for customization after application launch. 
     return true 
    } 
+1

작동 중! @ 잭에게 감사합니다. –

1

의 ViewController 만들기 AppDelegate에 클래스에 한 줄의 코드를 넣어 NSTimer를 사용하여 de 누워있는 시간. 타이머가 끝나면 첫 번째 UIViewcontroller를 푸시합니다. 의 viewDidLoad 방법에

..

[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(fireMethod) userInfo:nil repeats:NO]; 


-(void)fireMethod 
{ 
// push view controller here.. 
} 
[아이폰 OS? : 발사 화면을 지연하는 방법]의
관련 문제