1
我遇到了一個問題,我試圖在應用程序內顯示應用程序內橫幅(狀態欄上方)。問題是,當我在文本框中鍵入文本時,如果橫幅出現,它將移除鍵盤,然後一旦橫幅消失(它在計時器上),鍵盤再次顯示。有沒有辦法在狀態欄上方顯示橫幅視圖,同時如果鍵盤是第一響應者,則不會使鍵盤消失。顯示窗口級別的視圖UIWindowLevelStatusBar退出當前的第一響應者
InAppNotificationView* _sharedPushView = nil;
NSArray * nibArr = [[NSBundle mainBundle] loadNibNamed: @"InAppNotificationView" owner: self options: nil];
for (id currentObject in nibArr)
{
if ([currentObject isKindOfClass: [InAppNotificationView class]])
{
_sharedPushView = (InAppNotificationView*) currentObject;
break;
}
}
_sharedPushView.delegate = self;
[self.displayedPushViews addObject: _sharedPushView];
_topView.window.windowLevel = UIWindowLevelStatusBar;
[UIView animateWithDuration: 0.25
animations:^
{
CGPoint centerPoint = _sharedPushView.center;
centerPoint.y += _sharedPushView.frame.size.height;
_sharedPushView.center = centerPoint;
}
completion: nil];
[self.closeTimer invalidate];
self.closeTimer = nil;
self.closeTimer = [NSTimer scheduledTimerWithTimeInterval: 3.0f
target: self
selector: @selector(close)
userInfo: nil
repeats: NO];