开发者

How do you create a control during runtime on iOS

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜