开发者

How do you create a control during runtime on iOS

开发者 https://www.devze.com 2023-01-06 06:29 出处:网络
Is there a way to create a control during runtime? I tried something like UIButton* tempButton = [[UIButton alloc] initWithFrame:CGRectMake(120, 1开发者_开发技巧60, 40, 40)];

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

UIButton* tempButton = [[UIButton alloc] initWithFrame:CGRectMake(120, 1开发者_开发技巧60, 40, 40)];
[self.view insertSubview:tempButton atIndex:0];
[tempButton release];

it does not work


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

精彩评论

暂无评论...
验证码 换一张
取 消