I want to create a row with 4 buttons, the loop is doing what it should do, and it only enters the if statement 4 times as it should, but when the view pop’s out, I can see only one button on it.
Why is that? am I doing something wrong?
btnFrame = 18;
for (int i = 0; i < [arrImages count]; i++)
{
if (btnFrame <= 237)
{
NSLog(@"%i",btnFrame);
UIButton * tempBtn = [UIButton buttonWithType:UIButtonTypeCustom];
tempBtn.frame = CGRectMake(btnFrame, 20, 65, 65);
[tempBtn setTitle:[NSString stringWithFormat:@"Button%i",i] forState:UIControlStateNormal];
[self.view addSubview:tempBtn];
btnFrame = btnFrame + 73;
}
}
Thanks alot!
i think when your viewWillDisappear at that time this view will cleared so do bellow thing….
if you crete one method in which you just paste your above code and then when yourViewController appear at that time call your method try this…
hope this help you….
🙂