popwarsweet / PageControls

This is a selection of custom page controls to replace UIPageControl, inspired by a dribbble found here: https://dribbble.com/shots/2578447-Page-Control-Indicator-Transitions-Collection
MIT License
1.1k stars 90 forks source link

Center page control in its frame #4

Closed amarcadet closed 8 years ago

amarcadet commented 8 years ago

I'm facing an issue with the FilledPageControl where the items are not centered horizontally in the frame of the page control.

IB displays an error if I don't set a width or x constraint so the page control can't center itself in its superview. If I apply a center horizontally constraint it doesn't fix the error either.

popwarsweet commented 8 years ago

@amarcadet Each page control has a calculated intrinsicContentSize and therefore doesn't need width or height constraints, setting a top constraint and horizontally centered constraint will do the trick. If for some reason you are unable to get IB to cooperate, you can set a placeholder size w/in IB and the intrinsicContentSize will be respected at runtime.

amarcadet commented 8 years ago

Nice catch on the placeholder size, because it looks like the intrinsicContentSize is not working.