小编mic*_*cap的帖子

iOS 8键盘在解除模态视图控制器后解除延迟

在iOS 8+中,我注意到如果你有一个目前firstResponder在视图控制器中显示的文本字段,当视图控制器被解除时,键盘会在被解雇之前挂起约1秒钟.

iOS 8.0和8.1而不是 7.1 都会出现这种情况.

任何想法为什么会这样?

modalviewcontroller ios8

12
推荐指数
1
解决办法
2962
查看次数

为什么UIUserNotificationType.None在给出用户权限时在当前设置中返回true?

我正在编写一种方法来检查当前用户设置是否包含某些通知类型.

检查当前设置是否包含UIUserNotificationsType.None时,在给出和拒绝权限时,它都返回true.谁会知道为什么会这样?

func registerForAllNotificationTypes()
{
    registerNotificationsForTypes([.Badge, .Alert, .Sound])
}

func registerNotificationsForTypes(types:UIUserNotificationType)
{
    let settings = UIUserNotificationSettings.init(forTypes:types, categories: nil)
    UIApplication.sharedApplication().registerUserNotificationSettings(settings)
}

func isRegisteredForAnyNotifications() -> Bool
{
    let currentSettings = UIApplication.sharedApplication().currentUserNotificationSettings()
    print(currentSettings)
    print((currentSettings?.types.contains(.Alert))!)
    print((currentSettings?.types.contains(.Badge))!)
    print((currentSettings?.types.contains(.Sound))!)
    print((currentSettings?.types.contains(.None))!)

    return (currentSettings?.types.contains(.Alert))! //Just testing .Alert for now
}
Run Code Online (Sandbox Code Playgroud)

获得许可时:

Optional(<UIUserNotificationSettings: 0x7fabdb719360; types: (UIUserNotificationTypeAlert UIUserNotificationTypeBadge UIUserNotificationTypeSound);>) true true true true

许可关闭时:

Optional(<UIUserNotificationSettings: 0x7f96d9f52140; types: (none);>) false false false true

ios swift2

6
推荐指数
1
解决办法
872
查看次数

标签 统计

ios ×1

ios8 ×1

modalviewcontroller ×1

swift2 ×1