Sebastian Boldt
Sebastian Boldt

Reputation: 5321

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

Upvotes: 1

Views: 346

Answers (2)

estemendoza
estemendoza

Reputation: 3085

You have to do this:

- (UIEdgeInsets)widgetMarginInsetsForProposedMarginInsets:(UIEdgeInsets)defaultMarginInsets{
    return UIEdgeInsetsMake(0, 0, 0, 0);
}

Taken from Today Extension Not Positioned Correctly

Upvotes: 4

Kristian Bauer
Kristian Bauer

Reputation: 64

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.

Upvotes: 1

Related Questions