Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: BrightBit on June 24, 2014, 03:37:37 AM

Title: Centered Grids and Tables
Post by: BrightBit on June 24, 2014, 03:37:37 AM
Hi,

How can I center a table or a grid in the middle of a screen or in the middle of a widget? Is there a way to change the pivot of a table from "top left" to "center"?


Greetings
BrightBit
Title: Re: Centered Grids and Tables
Post by: ArenMook on June 24, 2014, 04:55:20 AM
No, table doesn't have a pivot. Only the grid does. You can reposition the table via code by using NGUITools.CalculateRelativeWidgetBounds to determine the bounds of the table, and then off-setting its position by half of its width and/or height.
Title: Re: Centered Grids and Tables
Post by: BrightBit on June 24, 2014, 06:08:53 AM
A bit unintuitive but it worked. Thank you. :)