这是我的代码:
if([pantallas objectForKey:par]){
UIView *vista= [[UIView alloc] initWithFrame:self.Botones.frame];
vista.backgroundColor= [UIColor brownColor];
CGSize la= CGSizeMake(50,60);
int cuantos= [part2 count];
NSArray *arr= [COLGenerales tileN:cuantos RectsOfSize:la intoSpaceOf:vista.frame withMaxPerRow:5 spaceVertical:10 spaceHorizontal:10];
for(int j=0; j<cuantos; j++){
UIButton *bot= [[UIButton alloc] initWithFrame:[[arr objectAtIndex:j] CGRectValue]];
bot.tag=j;
bot.titleLabel.text=par;
bot.titleLabel.hidden=true;
bot.imageView.image = [UIImage imageNamed:[[part2 allKeys] objectAtIndex:j]];
[bot addTarget:self action:@selector(registrar:) forControlEvents:UIControlEventTouchDown];
[vista addSubview:bot];
}
[pantallas setObject:vista forKey:par];
self.Botones= vista;
}else{
self.Botones= [pantallas objectForKey:par];
}
Botones 是嵌入到该类控制的视图中的简单视图(首先由 Nib 文件发起),COLGenerales 的类方法返回一个编码为 NSValues 的 CGRects 数组,registrar: 是一个本地方法。
一切都已正确设置(我已经用调试器彻底检查了这一点)。视图已成功创建、设置并添加到字典中。
但是,我绝对不会改变实际的屏幕。我什至包括了背景颜色更改,只是为了检查按钮是否存在某种问题。没有。对此有什么建议的解决方案吗?