在 Interface Builder 中,我构建了这个视图。1 是 UIButtons
但在 Iphone 6 Simulator 上,它看起来像这样
我将其中的 6 个视图设置在一个水平可滚动的视图中UIScrollView
。
[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
安排错误?提前致谢。