有没有办法在运行时创建控件?我试过像
这样的东西UIButton* tempButton = [[UIButton alloc] initWithFrame:CGRectMake(120, 160, 40, 40)];
[self.view insertSubview:tempButton atIndex:0];
[tempButton release];
它不起作用
答案 0 :(得分:0)
UIButton* tempButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] initWithFrame:CGRectMake(120, 160, 40, 40)];
[self.view insertSubview:tempButton atIndex:0];
[tempButton release];