SomeTimes,We want to add some UI complements to Window,and they are same frame size but only different title.How should we do? next is the sample code we can add UILabel with dynamic.
this is the yPos Change only,if u want change xPos ,U can change the method of yPos to xPos.
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero]; [label setFrame:CGRectMake(15, i%([titleArray count] + 1)*90+86, 100, 32)]; label.backgroundColor = [UIColor clearColor]; label.font = [UIFont systemFontOfSize:19.0f]; label.textColor = UIColorFromRGB(0x232323); label.text = [titleArray objectAtIndex:i]; label.textAlignment = UITextAlignmentCenter; [self.view addSubview:label];
if u want change xPos ,u can do this :
[label setFrame:CGRectMake(i%([titleArray count] + 1)*90+86, 20, 100, 32)];