notificationcenter

Dragging Gestures in iOS 8 Today Extensions

我是研究僧i 提交于 2019-11-29 03:26:38
问题 I'm using a UIView subclass in my Today widget. The view makes use of swiping gestures. However, these gestures either scroll the whole Notification Center up and down, or make the Notification Center switch from Today to Notifications . Is there any way to prevent the touch events to be bubbled up to the Notification Center scroll view? Using [self setExclusiveTouch:YES]; in the subclass did not solve it unfortunately. 回答1: Is there any way to prevent the touch events to be bubbled up to the

Fit width in iOS 8 Today Extensions

落花浮王杯 提交于 2019-11-28 17:29:29
When I make any iOS 8 Today Extension, there is an empty space on the left of approximately 48px, even if in Interface Builder I place a label on the left side at x=0. I have seen that some apps, however, use a full-width widget. How can I achieve something similar? Thanks! UPDATE: SOLVED I put here the sample code because I guess it will be useful to someone. As suggested by @matteo-lallone, the correct way to do this is: -(UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets)defaultMa‌​rginInsets{ return UIEdgeInsetsZero; } Matteo Lallone Straight from the docs: A Today

NotificationCenter issue on Swift 3 [duplicate]

百般思念 提交于 2019-11-27 05:57:38
This question already has an answer here: NSNotificationCenter addObserver in Swift 13 answers I'm learning Swift 3 and I'm trying to using NSNotificationCenter . Here is my code: func savePost(){ let postData = NSKeyedArchiver.archivedData(withRootObject: _loadedpost) UserDefaults.standard().object(forKey: KEY_POST) } func loadPost(){ if let postData = UserDefaults.standard().object(forKey: KEY_POST) as? NSData{ if let postArray = NSKeyedUnarchiver.unarchiveObject(with: postData as Data) as? [Post]{ _loadedpost = postArray } } //codeerror NotificationCenter.default().post(NSNotification(name:

NotificationCenter issue on Swift 3 [duplicate]

这一生的挚爱 提交于 2019-11-26 12:49:55
问题 This question already has an answer here: NSNotificationCenter addObserver in Swift 13 answers I\'m learning Swift 3 and I\'m trying to using NSNotificationCenter . Here is my code: func savePost(){ let postData = NSKeyedArchiver.archivedData(withRootObject: _loadedpost) UserDefaults.standard().object(forKey: KEY_POST) } func loadPost(){ if let postData = UserDefaults.standard().object(forKey: KEY_POST) as? NSData{ if let postArray = NSKeyedUnarchiver.unarchiveObject(with: postData as Data)