iOS - UIPageViewController size Inferred vs. Freeform [duplicate]
Asked Answered
W

2

6

I came across this in XCode 5's "Storyboard Builder" and I didn't really get the idea. When I add a new UIPageViewController to the screen, I can select the Size in the attributes in the Simulated Metrics dropdown. There are a few options, but I don't get the difference between two: Inferred and Freeform. What is the difference between these two? My understanding is that there's no difference, because both open up the Controller to be any size the program tells it to be.

Could someone explain this to me?

Whoopee answered 28/6, 2014 at 1:47 Comment(0)
I
8

What's important to understand about Simulated Metrics is that they're just that: simulated.

Simulated Metrics let you adjust some things about how an item appears in the storyboard. The most common cause for confusion regarding simulated metrics is usually tab bars, navigations bars, or status bar. You can use simulated metrics to show/hide these in the storyboard. Using inferred with these will use context to determine whether or not it thinks this view will show it based on how you set previous views and whether or not it's embedded, etc.

But at the end of the day when you run your program, whether or not a tab bar shows is based on what you've done in code and will never have anything to do with the simulated metric.

The same is true for EVERY simulated metric on the storyboard. They're simply means for controlling the storyboard preview of the item only.

Ilise answered 28/6, 2014 at 2:7 Comment(2)
So even if I were to select the 3.5 Retina option, it would only be to see what the view would behave like if it were on a 3.5 retina screen?Whoopee
If you select 3.5 Retina, the storyboard representation of the view will look like it would on a 3.5 Retina device. This setup isn't necessarily what it will look like on the 4" device though, depending on how your view is setup, autolayout, etc.Ilise
C
2

Inferred restricts the size of the UIPageViewController storyboard to the sizes of the screens of iOS devices (specifically, the one your storyboard is for). If you select freeform, you can change the size of UIPageViewController to the size you wish.

For instance, I've used that to create views which had content outside of the screen (which would slide in during use).

Ceremonious answered 28/6, 2014 at 1:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.