"Learn Ngui from scratch" (12) Uigrid

Source: Internet
Author: User

"Learn Ngui from scratch" (12) Uigrid
In many cases, we will use a list of changes, backpacks, announcements, activities, and so on, usually we will use the Uigrid
Creating Uigriduigrid is typically used in combination with Uiscrollview
First Open Ngui Prefab ToolbarNgui-> Open, Prefab Toolbar
Drag a background into the hierarchy panel to create a sprite as a scrollview background create a grid under ScrollView and create a few cells in the grid (the cell makes a button)Ps. When adding a cell, there may be a lot of cell overlap in the editing interface, but it doesn't overlap when it's running. Uigrid will rearrange the cells (but I'm still uncomfortable with it – I'm not happy to treat you haha)There's a little trick that can be arranged under the editor. Click the small icon behind the Uigrid and Excute
The location will be the same as when the game is running.
Add the Uidragscrollview component to each cell and assign a value for its scrollview to the scrollview you just created, roughly as follows
This time, the operation found that Uigird's location was wrong.
Determining the location of this grid is a headache, this problem has plagued me for a long time, to see the solution is to have all the cells below the grid pivot set to left but I do not want to do this because each cell created by default is the center of the adjustment Uigrid location
Thought for a long time, tried for a long time, found this the coordinate position of the gird is the position of the first cell relative to the ScrollViewBecause I added two columns, so the coordinates of the gird are
For example, the size of the ScrollView I created is 400 * 50 for the size of the cell, and two columns are displayed so the first cell coordinates are ( -400/2, 500/2-50/2) i.e.: (-200, 225) This time the position is That's right.



"Learn Ngui from scratch" (12) Uigrid

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.