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