gpt4 book ai didi

iphone - 为什么我的 UIButton 没有显示?

转载 作者:太空狗 更新时间:2023-10-30 04:00:38 24 4
gpt4 key购买 nike

这是我正在使用的代码:

UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(100, 200, 50, 70)];
[self.view addSubview:button];
if (buttonArray == nil) {
buttonArray = [[NSMutableArray alloc] init];
}
[buttonArray addObject:button];
[button release];

然而,对接并未显示。有什么想法吗?

最佳答案

你初始化错误。尝试以下操作:

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(100, 200, 50, 70);
[self.view addSubview:button];
if (buttonArray == nil) {
buttonArray = [[NSMutableArray alloc] init];
}
[buttonArray addObject:button];

关于iphone - 为什么我的 UIButton 没有显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5279415/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com