简体   繁体   中英

Can UNNotificationContentExtension handle swipe?

I have been working with UNNotificationContentExtension and I have created a custom UI containing a scrollView. I load the scrollView with Image View and it's an Image Carousel and the image carousel should move horizontally.

My scroll view is getting set properly however the scrollView does not scroll horizontally.

I checked that my images are in the carousel by programmatically scrolling with

scrollView.setContentOffset(CGPoint(x: x, y: y), animated: true)

Also, each of my images should open different pages in my app. So what I have done is added tap gesture to the individual imageViews.

So my questions are,

Is it possible for UNNotificationContentExtension to translate a scrollView in horizontal direction?

Is it possible to open different pages in app based on the images clicked?

So my questions are,

Is it possible for UNNotificationContentExtension to translate a scrollView in horizontal direction?

Is it possible to open different pages in app based on the images clicked?

No and no. UNNotificationContentExtension is not user interactive in any way, except for elements like the Play button that the runtime inserts for you upon request.

EDIT : Note that this was correct in iOS 11 and before, but changed in iOS 12, where it became possible, in the NSExtensionAttributes in the Info.plist , to add the UNNotificationExtensionUserInteractionEnabled Boolean key and set its value to YES . Now the entire mechanism for user interaction springs to life.

So my questions are,

Is it possible for UNNotificationContentExtension to translate a scrollView in horizontal direction?

Is it possible to open different pages in app based on the images clicked?

Yes and yes. Set UNNotificationExtensionUserInteractionEnabled in your plist file to YES. The previous answer said "No," but this is no longer correct as of iOS 12.

When asked, this was not possible, and was not for iOS 10 and iOS 11.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM