From 4286f754f261eb5f10c9455b199dc591ea0188cf Mon Sep 17 00:00:00 2001 From: xuemh Date: Thu, 15 Mar 2018 22:02:53 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90iPhoneX=E9=80=82=E9=85=8D=E3=80=91?= =?UTF-8?q?=E5=BC=95=E5=AF=BC=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyIntroductionViewController.m | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Ifish/views/introductionView/MyIntroductionViewController.m b/Ifish/views/introductionView/MyIntroductionViewController.m index 485ecd1..792145c 100644 --- a/Ifish/views/introductionView/MyIntroductionViewController.m +++ b/Ifish/views/introductionView/MyIntroductionViewController.m @@ -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; iself.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]; }