【iPhoneX适配】引导页面
This commit is contained in:
parent
0dd40d6d5c
commit
4286f754f2
|
|
@ -94,21 +94,18 @@ static MyIntroductionViewController * introduction = nil;
|
|||
}
|
||||
|
||||
-(void)setUpScrollView{
|
||||
self.scrollView.contentSize = CGSizeMake(self.scrollView.bounds.size.width*self.imageNames.count, self.scrollView.bounds.size.height);
|
||||
CGFloat width = CGRectGetWidth([UIScreen mainScreen].bounds);
|
||||
CGFloat height = CGRectGetHeight([UIScreen mainScreen].bounds);
|
||||
self.scrollView.contentSize = CGSizeMake(width * self.imageNames.count, height);
|
||||
self.scrollView.bounces=NO;
|
||||
//views
|
||||
for (int i=0; i<self.imageNames.count; i++) {
|
||||
UIImageView * imgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:self.imageNames[i]]];
|
||||
imgV.userInteractionEnabled=true;
|
||||
CGRect frame = imgV.frame;
|
||||
CGFloat oldH = imgV.bounds.size.height;
|
||||
CGFloat oldW = imgV.bounds.size.width;
|
||||
if (frame.size.width>self.scrollView.frame.size.width) {
|
||||
frame.size.width = self.scrollView.bounds.size.width;
|
||||
frame.size.height = frame.size.width * oldH / oldW;
|
||||
imgV.frame = frame;
|
||||
}
|
||||
imgV.center = CGPointMake((i+0.5)*self.scrollView.bounds.size.width, self.scrollView.bounds.size.height/2);
|
||||
imgV.contentMode = UIViewContentModeScaleAspectFill;
|
||||
imgV.layer.masksToBounds = YES;
|
||||
CGFloat x = i * width;
|
||||
imgV.frame = CGRectMake(x, 0, width, height);
|
||||
[self.scrollView addSubview:imgV];
|
||||
[self.imageViews addObject:imgV];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue