Hello!
I've a simple (but complicated for me) question to ask to you.
I download an ID and subcategory name from a json that is generated from a php page on my hosting.
Now, I would like to generate X uibutton of the same subcategory quantities that i've in my json.
I've developed this code, but how I can insert a distance between the uibuttons that i've generated?
Thanks for the help!
I've a simple (but complicated for me) question to ask to you.
I download an ID and subcategory name from a json that is generated from a php page on my hosting.
Now, I would like to generate X uibutton of the same subcategory quantities that i've in my json.
I've developed this code, but how I can insert a distance between the uibuttons that i've generated?
Code:
for(int i=0; i<[dataArray count];i++)
{
mydata= [dataArray objectAtIndex:i];
NSString *sottocategoria =[mydata objectForKey:@"sottocategoria"];
int idsottocategoria = [[mydata objectForKey:@"ID"] integerValue];
float x = gap * (i+1) + width * i;
UIButton *button_sottocategoria = [UIButton buttonWithType:UIButtonTypeSystem];
button_sottocategoria.tag = idsottocategoria;
[button_sottocategoria setTitle:sottocategoria forState:UIControlStateNormal];
[button_sottocategoria setFrame:CGRectMake(x,y,width,height)];
[self.view addSubview:button_sottocategoria];
}
Thanks for the help!