Is there a way to define a space for a particular cell? I am able to set spacing for all cells with the following property in gridview:
_grid.columnSpacing
I display five views on the screen. I need to set more spacing only for the second and the fourth views that are displayed on the screen.
Hi,
ColumnSpacing is uniform. So it can only be applied to all or none.
If you want additional space on a particular column, your best option is a custom cell, and insetting your content.
-SteveZ
Hi Steve, insetting you mean updating it's frame( origin.x ) during the transition?
Hey,
Basically, just laying out the content in the cell, so that it doesn't use the full space.
For example. if i was just displaying a label in a custom cell, i might do something like this.
-(void)setupSize:(CGSize)size{ // Without Inset myLabel.frame = CGrectMake(0, 0, size.width, size.height); // With Inset CGFloat padding = 10; myLabel.frame = CGRectMake(padding, 0, size.width - padding*2, size.height); }
What i'm doing is no longer using the full width of the column, but instead leaving a gap in front of and after the label.
This assumes of course that i'm not setting a background color on the cell.
Thank you so much Steve for your great technical support!! I really appreciate it.
No problem.
You can actually control that with the existing sample.
There is a variable called spacing. This is the spacing between cells.
You can play around with that variable until you find something that works for you.
CGFloat spacing = scaledItemSize/2; // Try making it something like scaledItemSize/2.75 to decrease the spacing
Let me know how that works for you.
CGFloat spacing = scaledItemSize/2.1;
gives me this screenshot. I only need to adjust the spacing at the left and right side of the centre circle not all spacing in between the circles.
Thank you Steve. I really appreciate your technical support! The following setting is really nice. With the help of this parameter I am able to adjust the center view's size.
CGFloat additionalMulitper = .5f; // Increase this to make the center circle even bigger
I still need to slightly bring the circles under the centre one. Is there a way for to do this with another parameter? like distancefromcenter = .2f; will bring the circles close to the center circle. The sizes of the circles are ok except the space next to the centre circle.
Sure.
You can't just increase the Max scale, b/c that will affect all the cells relative size.
Instead, you need a little big of additional logic.
I've adjusted the sample. There is a new local variable:
To make the center item bigger, just increase this multiplier and you should get your desired results.
Hope this helps,