在Interface Builder中,我构建了这个视图。1是UIButtons

但在iPhone6模拟器上,它看起来像这样

我在一个水平滚动的UIScrollView中设置了6个相邻的视图。
[self.slips setContentSize:CGSizeMake(1842.0f, 322.0f)];
self.slip1 = [[Slip alloc]initWithFrame:CGRectMake(0.0f, 0.0f, 307.0f, 322.0f)];
[self.slips addSubview:self.slip1];
self.slip2 = [[Slip alloc]initWithFrame:CGRectMake(307.0f, 0.0f, 307.0f, 322.0f)];
[self.slips addSubview:self.slip2];
self.slip3 = [[Slip alloc]initWithFrame:CGRectMake(614.0f, 0.0f, 307.0f, 322.0f)];
[self.slips addSubview:self.slip3];
self.slip4 = [[Slip alloc]initWithFrame:CGRectMake(921.0f, 0.0f, 307.0f, 322.0f)];
[self.slips addSubview:self.slip4];
self.slip5 = [[Slip alloc]initWithFrame:CGRectMake(1228.0f, 0.0f, 307.0f, 322.0f)];
[self.slips addSubview:self.slip5];
self.slip6 = [[Slip alloc]initWithFrame:CGRectMake(1535.0f, 0.0f, 307.0f, 322.0f)];
[self.slips addSubview:self.slip6];其中slips是UIScrollView
slip1是UIView的子类,设置如下
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code.
//
[[NSBundle mainBundle] loadNibNamed:@"LottoSlip" owner:self options:nil];
[self addSubview:self.rootView];
}
return self;
}有没有人能帮我解释一下为什么UIButtons的排列是错误的?提前谢谢。
发布于 2013-05-03 00:53:46
如果其他人有问题的话。我修复了它,使用的图像大小正好是自定义UIButtons的大小,以及一个具有双倍大小和命名约定的图像版本。
imageName.png和
imageName@2x.png现在它起作用了。
发布于 2013-05-02 15:58:48
请转到硬件并检查设备并选择,如上图所示。

https://stackoverflow.com/questions/16332806
复制相似问题