diff --git a/expandZoom.xcodeproj/project.pbxproj b/expandZoom.xcodeproj/project.pbxproj index 8ae5a86..888a480 100644 --- a/expandZoom.xcodeproj/project.pbxproj +++ b/expandZoom.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ 0455FD8117788E860036EFD8 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0455FD8017788E860036EFD8 /* Default-568h@2x.png */; }; 0455FD8417788E860036EFD8 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0455FD8217788E860036EFD8 /* MainStoryboard.storyboard */; }; 0455FD8717788E860036EFD8 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0455FD8617788E860036EFD8 /* ViewController.m */; }; + 0455FD8E17788F990036EFD8 /* LaraCroft@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0455FD8D17788F980036EFD8 /* LaraCroft@2x.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -37,6 +38,7 @@ 0455FD8317788E860036EFD8 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; 0455FD8517788E860036EFD8 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 0455FD8617788E860036EFD8 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 0455FD8D17788F980036EFD8 /* LaraCroft@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "LaraCroft@2x.png"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -88,6 +90,7 @@ 0455FD8217788E860036EFD8 /* MainStoryboard.storyboard */, 0455FD8517788E860036EFD8 /* ViewController.h */, 0455FD8617788E860036EFD8 /* ViewController.m */, + 0455FD8D17788F980036EFD8 /* LaraCroft@2x.png */, 0455FD7117788E860036EFD8 /* Supporting Files */, ); path = expandZoom; @@ -163,6 +166,7 @@ 0455FD7F17788E860036EFD8 /* Default@2x.png in Resources */, 0455FD8117788E860036EFD8 /* Default-568h@2x.png in Resources */, 0455FD8417788E860036EFD8 /* MainStoryboard.storyboard in Resources */, + 0455FD8E17788F990036EFD8 /* LaraCroft@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/expandZoom/LaraCroft@2x.png b/expandZoom/LaraCroft@2x.png new file mode 100644 index 0000000..94958ab Binary files /dev/null and b/expandZoom/LaraCroft@2x.png differ diff --git a/expandZoom/ViewController.h b/expandZoom/ViewController.h index c3f2ddc..d23ef69 100644 --- a/expandZoom/ViewController.h +++ b/expandZoom/ViewController.h @@ -8,6 +8,6 @@ #import -@interface ViewController : UIViewController +@interface ViewController : UITableViewController @end diff --git a/expandZoom/ViewController.m b/expandZoom/ViewController.m index 00588a4..9015533 100644 --- a/expandZoom/ViewController.m +++ b/expandZoom/ViewController.m @@ -8,8 +8,11 @@ #import "ViewController.h" -@interface ViewController () +static CGFloat kImageOriginHight = 240.f; + +@interface ViewController () +@property (strong, nonatomic) IBOutlet UIImageView *expandZoomImageView; @end @implementation ViewController @@ -18,6 +21,25 @@ { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. + + self.tableView.contentInset = UIEdgeInsetsMake(kImageOriginHight, 0, 0, 0); + [self.tableView addSubview:self.expandZoomImageView]; +} + +- (void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + + self.expandZoomImageView.frame = CGRectMake(0, -kImageOriginHight, self.tableView.frame.size.width, kImageOriginHight); +} + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ + CGFloat yOffset = scrollView.contentOffset.y; + if (yOffset < -kImageOriginHight) { + CGRect f = self.expandZoomImageView.frame; + f.origin.y = yOffset; + f.size.height = -yOffset; + self.expandZoomImageView.frame = f; + } } - (void)didReceiveMemoryWarning diff --git a/expandZoom/en.lproj/MainStoryboard.storyboard b/expandZoom/en.lproj/MainStoryboard.storyboard index c9acc6d..5b5e477 100644 --- a/expandZoom/en.lproj/MainStoryboard.storyboard +++ b/expandZoom/en.lproj/MainStoryboard.storyboard @@ -1,23 +1,61 @@ - + - + - - + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +