Search code examples
ioscocoa-touchios-app-extension

How to make an iOS-App Extension for the Notification Center full width?


I am currently trying to develop my own iOS-App Extension for the Notification-Center but there is a problem with the width. I can not change my widget to be full width like the Calender-Extension on the screenshot. There is always some space to the left that cuts of my Viewcontroller content. (See the Number Widget at the second Screenshot) It seems this is the default behaviour, but there must be a way around this. Any Ideas how to solve this Issue ?

enter image description here

enter image description here


Solution

  • In your main extension view controller, override - (UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets)defaultMarginInsets and return whatever UIEdgeInsets your extension needs. If you want 0 padding on all sides, simply return UIEdgeInsetsZero.