tags:

views:

11

answers:

1

Is there a way to create a control during runtime? I tried something like

UIButton* tempButton = [[UIButton alloc] initWithFrame:CGRectMake(120, 160, 40, 40)];
[self.view insertSubview:tempButton atIndex:0];
[tempButton release];

it does not work

A: 
UIButton* tempButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] initWithFrame:CGRectMake(120, 160, 40, 40)];
[self.view insertSubview:tempButton atIndex:0];
[tempButton release];
Aaron Saunders