直到我点击她的超级视图,UIButton才能显示

时间:2012-03-21 07:41:49

标签: iphone cocos2d-iphone uibutton

UIButton *submitBtn = [UIButton buttonWithType:UIButtonTypeCustom];

submitBtn.frame=CGRectMake(48, 145, 62, 24);

[submitBtn setBackgroundImage:[UIImage imageNamed:@"images/public/submit.png"] forState:UIButtonTypeCustom];

[submitBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];

[submitBtn setNeedsDisplay];

[self addSubview:submitBtn];

我创建了视图A并在视图A中添加了视图B,视图B有一个submitbtn UI按钮!

为什么这个submitbtn按钮无法显示!! 但我点击他的超级视图,它可以再次显示!

1 个答案:

答案 0 :(得分:0)

在超级视图上添加此Btn

    [self.view bringSubviewToFront:object_Btn];

试试这个

相关问题