Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XIB: Centering elements

I have an XIB file containing a simple activity indicator that I want to be vertically and horizontally centered. In XCode I can center it in w:compact and h:compact, but when I run it on the device its not centered (is offset). I have searched and I found suggestions on constraints or disabling auto layout, but when I do any of these my activity indicator is not shown in the view anymore.
I'd appreciate if you can help me with this. Thanks.

like image 733
m0j1 Avatar asked Dec 03 '25 16:12

m0j1


1 Answers

Add Activity indicator and select it and add constraints like in image.

Autolayout constaraints

P.S - Learning curve of auto layout is very tricky and require patience. The more you practice, more you improve. Read online tutorials, youth videos..Implement!

like image 175
Bista Avatar answered Dec 06 '25 07:12

Bista



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!