I'm trying to find out how to calculate the actual left margin in my Today extension main view to align the contents to the rest of the Today view.
Here's a screenshot of the Today extension (green = my extension's main view) using iPhone 6 Plus simulator in both portrait and landscape mode:
The red dashed line in the screenshots illustrates the line I'm trying to align the red and blue UILabel
s to. It seems that the red line - main views left border alignment is different in each device: iPhone 5x, iPhone 6 and iPads.
Currently, the main view gets resized by iOS to the maximum width, and both the UILabel
s are attached with self.view.layoutMargin = UIEdgeInsetsZero
to the left border.
It seems that the UIView
s layoutMargin
isn't the solution here, the values seem to be the default UIView
values (8 pixels all edges).
How do I align the two UILabel
s to the dashed line?
Edit:
The behavior can be reproduced using a clean Xcode project (I'm using Xcode 6.1.1, iOS 8.1 and Swift):
- Create an empty Xcode project (A single-view application)
- Add a new Target: Extensions > Today extension
- From the Today extension group, find MainInterface.storyboard and make the main view background green and Hello world
UILabel
background red:
The result in iPhone 6 Plus simulator:
Aucun commentaire:
Enregistrer un commentaire