Blog

Full width iOS Today Extension

18 Sep, 2014
Xebia Background Header Wave

Apple decided that the new Today Extensions of iOS 8 should not be the full width of the notification center. They state in their documentation:

Because space in the Today view is limited and the expected user experience is quick and focused, you shouldn’t create a widget that’s too big by default. On both platforms, a widget must fit within the width of the Today view, but it can increase in height to display more content.

Source: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/NotificationCenter.html
This means that developers that create Today Extensions can only use a width of 273 points instead of the full 320 points (for iPhones pre iPhone 6) and have a left offset of the remaining 47 points. Though with the release of iOS 8, several apps like DropBox and Evernote do seem to have a Today Extension that uses the full width. This raises question wether or not Apple noticed this and why it came through the approval process. Does Apple not care?
Should you want to create a Today Extension with the full width yourself as well, here is how to do it (in Swift):
[objc]
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
if let superview = view.superview {
var frame = superview.frame
frame = CGRectMake(0, CGRectGetMinY(frame), CGRectGetWidth(frame) + CGRectGetMinX(frame), CGRectGetHeight(frame))
superview.frame = frame
}
}
[/objc]
This changes the super view (Today View) of your Today Extension view. It doesn’t use any private Api’s, but Apple might reject it for not following their rules. So think carefully before you use it.

Questions?

Get in touch with us to learn more about the subject and related solutions

Explore related posts