today-extension

Dragging Gestures in iOS 8 Today Extensions

廉价感情. 提交于 2019-11-30 13:04:21
问题 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

Today Extension: How to work with display mode?

不羁岁月 提交于 2019-11-30 07:27:39
问题 Widgets now include the concept of display mode (represented by NCWidgetDisplayMode), which lets you describe how much content is available and allows users to choose a compact or expanded view. How to expand widget in ios 10.0? It doesn't work as in ios 9. 回答1: Ok, i found right solution here. 1) Set the display mode to NCWidgetDisplayMode.expanded first in viewDidLoad : override func viewDidLoad() { super.viewDidLoad() self.extensionContext?.widgetLargestAvailableDisplayMode =

What is the height of the new iOS 10 Today Widget/Extension?

梦想与她 提交于 2019-11-30 00:07:26
I am building an iOS Today widget, and while testing for iOS 10 I noticed that all widgets are now being given the same height (previous versions allowed the dev to set the height). What is the ideal height/what is the best practice for dealing with this new limitation? I'm in swift and I didn't use autolayout fyi. Thanks in advance! In iOS 10, by default, the height of today widget is fixed. Moreover, the minimum height of collapsed widget is limited. A collapsed widget is the height of roughly two and a half table rows. An expanded widget is ideally no taller than the height of the screen.

Maximum height of iOS 8 Today Extension?

扶醉桌前 提交于 2019-11-29 20:18:26
I am working on a Today Extension with a dynamically sized table. I have been able to get the table to resize for the content using: self.preferredContentSize = accountsTable.contentSize However, I have found that it will not get taller than a certain size (568 px) even though I can tell the table contentSize is larger. I'm not clear if this is a built-in limit or if there is a way around this to make a larger view. It appears that some previous extensions (Stocks widget) is able to become larger. Anyone else running into the same behavior. Anyone know if it's possible to make an extension

iOS Swift Today Extension: import class from container app?

爷,独闯天下 提交于 2019-11-29 11:20:29
问题 I have an app with a Today widget. I would like to use a model class from the container app in the TodayViewController.swift . Is such a thing possible? I copied the file into the Today Extension folder and tried to import it. No dice. I can't find an answer in the documentation or online. Thanks 回答1: You need to include the file in the target membership. Select the file and then, in the right hand pane, tick the correct target. 来源: https://stackoverflow.com/questions/28301662/ios-swift-today

Finding out if the device is locked, from a Notification Widget

£可爱£侵袭症+ 提交于 2019-11-29 11:18:03
I'd like to know if the device is locked when I'm loading my Notification/Today widget, so I can show the widget appropriately. (it's financial, and we don't want to show balances on a locked phone) On devices with TouchID, I can just try to access the Keychain, and if I get errSecInteractionNotAllowed back, it's locked. All good. This doesn't work on devices without touchID (but with a PIN). I've found a few things, which recommend using [[UIApplication sharedApplication] protectedDataAvailable] However I don't have [UIApplication sharedApplication] in a widget. Any ideas where and how to do

Sharing UserDefaults between extensions

强颜欢笑 提交于 2019-11-29 05:35:44
问题 Creating a Today widget and I am using UserDefaults(suiteName:) to persist some data. In the main application I am using UserDefaults.standard() . This can't be read (or can it?) by the extension which is why I use the suiteName: constructor. Data that user persist to UserDefaults.standard() in the main app needs to be available in the extension. At this time I am persisting to both so that the values can be shared UserDefaults.standard().set:...forKey:... UserDefaults(suiteName:...)().set:..

Today Extension: How to work with display mode?

橙三吉。 提交于 2019-11-29 04:09:46
Widgets now include the concept of display mode (represented by NCWidgetDisplayMode ), which lets you describe how much content is available and allows users to choose a compact or expanded view. How to expand widget in ios 10.0? It doesn't work as in ios 9. Vladius001 Ok, i found right solution here . 1) Set the display mode to NCWidgetDisplayMode.expanded first in viewDidLoad : override func viewDidLoad() { super.viewDidLoad() self.extensionContext?.widgetLargestAvailableDisplayMode = NCWidgetDisplayMode.expanded } 2) Implement new protocol method: func widgetActiveDisplayModeDidChange(_

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

What is the height of the new iOS 10 Today Widget/Extension?

本小妞迷上赌 提交于 2019-11-28 21:49:49
问题 I am building an iOS Today widget, and while testing for iOS 10 I noticed that all widgets are now being given the same height (previous versions allowed the dev to set the height). What is the ideal height/what is the best practice for dealing with this new limitation? I'm in swift and I didn't use autolayout fyi. Thanks in advance! 回答1: In iOS 10, by default, the height of today widget is fixed. Moreover, the minimum height of collapsed widget is limited. A collapsed widget is the height of