문제

How would I vertically center a view with Pixate?

If I was styling a web element I would do something like this:

element {
    margin: 0 auto;
}

Pixate apparently does not have margin but you can use left and right to specify the position from neighbor elements.

So I thought it could be something like this:

element {
    left: auto;
    right: auto;
}

But that does not work. The view stays in the upper left corner of the screen.

Is there a way to do this without using aboslute pixel coordinates which I'd like to avoid?

도움이 되었습니까?

해결책

As far as I know, the only ways to dynamically center a view are:

  1. Auto Layout constraints
  2. Springs and struts (if you're not using Auto Layout)
  3. Dynamic, mathematical placement of the view using CGRect

I don't believe Pixate offers any view placement options.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top