我构建了这个视图。 1是UIButtons
但在Iphone 6 Simulator上,它看起来像这样
我在水平滚动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
错误排列的原因吗?
在此先感谢。
答案 0 :(得分:0)
请转到硬件并检查设备并选择如上图所示..
答案 1 :(得分:0)
如果其他人有问题。我使用与自定义UIButtons大小完全相同的图像以及具有加倍大小和命名约定的图像版本来修复它。
imageName.png
和
imageName@2x.png
现在有效。