当用户点击屏幕时,应该出现一个带有按钮的弹出窗口。但我不知道为什么在弹出窗口中没有显示按钮。这是因为它是子视图中的子视图所以出了问题吗?
-(void) popUpWithX:(int)x andY:(int)y {
CGRect popUpRect = CGRectMake(x, y, 125, 75);
popUp = [[UIView alloc] initWithFrame:popUpRect];
popUp.backgroundColor = [UIColor whiteColor];
popUp.layer.cornerRadius = 7.5f;
popUp.layer.masksToBounds = YES;
[self.view addSubview:popUp];
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
[button setTitle:@"Click me!" forState:UIControlStateNormal];
[popUp addSubview:button];
}
编辑:
UIButton的坐标可能是错误的吗?我不确定坐标系是来自主视图还是弹出子视图。