我就是这样做的
-(IBAction)clickButtonPressed:(id)sender
{
NSLog(@"Clicked.........");
UIView *showView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[self.view addSubview:showView];
}
此行动称为&没有任何错误,但此视图也未显示。
答案 0 :(得分:0)
尝试设置视图的背景颜色以确保在没有您注意的情况下实际添加它,并在添加视图后释放视图(如果您不使用ARC)
-(IBAction)clickButtonPressed:(id)sender {
NSLog(@"Clicked.........");
UIView *showView=[[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
showView.backgroundColor = [UIColor blackColor];
[self.view addSubview:showView];
[showView release]; // if not ARC
}