는, 아이폰 OS가 경고를 표시하지 않습니다 아래로 별도로 그들을 처리 할 수 있습니다, 당신은 비록 배경 또는 전경 여부에 상관없이 트리거 이 경우, 당신은
당신은 이런 식으로 작업을 수행 할 수 있습니다 ... 스스로를해야 할 :
는 'PN 전경보기'에 대한 펜촉을 작성, 예를 들면 :
,
그리고 당신은 전경에 PN을 얻을 때, 당신은보기를 인스턴스화 할 수 있으며, 예를 들어, 애니메이션으로 UIWindow에 코드를 추가 :
// init and configure your custom PN foreground view
let nib = UINib(nibName: self.nibName, bundle: NSBundle(forClass: PnForegroundView))
pnForegroundView = nib.instantiateWithOwner(nil, options: nil)[0] as! PnForegroundView
pnForegroundView.setWidth(UIScreen.width)
pnForegroundView.setHeight(63)
pnForegroundView.title = <some title from notification>
pnForegroundView.image = <some image from notification>
// add the view to the key window
let window = UIApplication.sharedApplication().keyWindow!
window.addSubview(pnForegroundView!)
// Change window level to hide the status bar
window.windowLevel = UIWindowLevelStatusBar
// Show the PN foreground view with animation:
self.pnForegroundView!.setBottom(0)
self.changeWindowLevelToHideStatusBar()
UIView.animateWithDuration(0.2) {
self.pnForegroundView!.setBottom(self.pnForegroundView!.height)
}
는 물론, 당신이 대리인을 설정해야 이보기에서는 사례 사용자가 알림을 클릭하고 사용자가 알림을 닫을 때 사용됩니다.
또한 자동 해고에 시간을 추가 할 수 있습니다.
마지막 일 - PnForegroundView
을 제거 할 때, 당신은 더 나은 AppDelegate에 방법에 completionHandler 라인은 나를 위해 일한 것을 추가
그래 난을 알고 있지만 배경에 앱이있을 때 같은 경고 알림을 표시하고 싶습니다. –
버디는 앱이 백그라운드에 있고 활성화되어있을 때 로컬 알림을 만들어서 던져 버릴 수 있습니다. 원격 알림처럼 절대적으로 보입니다. 배지 카운트도 처리 할 수 있지만 사용자 탭 당신이 didRecieveLocalNotification 메쏘드에서 제어권을 얻게 될 알림에 대해서 : –
나는 벌써 그 일을했습니다, 나는 배너 경고를 얻지 못했습니다, 그냥 소리 나 경고없이 알림 센터에 표시됩니다 –