Develop

[ios] 스크린 캡쳐 (전원버튼 + 홈버튼) 호출 알아내기

by hooni posted Nov 19, 2014
?

Shortcut

PrevPrev Article

NextNext Article

ESCClose

Larger Font Smaller Font Up Down Go comment Print

# Objective-C

// Objective-C
NSOperationQueue *mainQueue = [NSOperationQueue mainQueue];
[[NSNotificationCenter defaultCenter]
    addObserverForName:UIApplicationUserDidTakeScreenshotNotification
    object:nil
    queue:mainQueue
    usingBlock:^(NSNotification *notification) {
        // 스크린캡쳐후 처리
    }];

# Swift

// Swift
let mainQueue = NSOperationQueue.mainQueue()
NSNotificationCenter.defaultCenter().addObserverForName(
    UIApplicationUserDidTakeScreenshotNotification,
    object: nil,
    queue: mainQueue)
{
    notification in
    // 스크린캡쳐후 처리
}