From dfe68a5db6cfdfcb533990b34e8489c7c6328529 Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Sun, 5 Nov 2017 15:16:14 +0800 Subject: [PATCH] Update demo to use modern way of image assets, and view layout for rotation --- .../SDWebImage Demo.xcodeproj/project.pbxproj | 16 ++++--------- .../AppIcon.appiconset/Contents.json | 0 .../Assets.xcassets/Contents.json | 6 +++++ .../placeholder.imageset/Contents.json | 22 ++++++++++++++++++ .../placeholder.imageset}/placeholder.png | Bin .../placeholder.imageset}/placeholder@2x.png | Bin .../SDWebImage Demo/DetailViewController.m | 8 +++++-- 7 files changed, 38 insertions(+), 14 deletions(-) rename Examples/SDWebImage Demo/{Images.xcassets => Assets.xcassets}/AppIcon.appiconset/Contents.json (100%) create mode 100644 Examples/SDWebImage Demo/Assets.xcassets/Contents.json create mode 100644 Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/Contents.json rename Examples/SDWebImage Demo/{ => Assets.xcassets/placeholder.imageset}/placeholder.png (100%) rename Examples/SDWebImage Demo/{ => Assets.xcassets/placeholder.imageset}/placeholder@2x.png (100%) diff --git a/Examples/SDWebImage Demo.xcodeproj/project.pbxproj b/Examples/SDWebImage Demo.xcodeproj/project.pbxproj index af8e6507..7e90ccf0 100644 --- a/Examples/SDWebImage Demo.xcodeproj/project.pbxproj +++ b/Examples/SDWebImage Demo.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 32892E311FAE898C00BE8320 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32892E301FAE898C00BE8320 /* Images.xcassets */; }; + 32892E311FAE898C00BE8320 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 32892E301FAE898C00BE8320 /* Assets.xcassets */; }; 32892E351FAE89FE00BE8320 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 32892E341FAE89FD00BE8320 /* LaunchScreen.storyboard */; }; 3E75A9861742DBE700DA412D /* CustomPathImages in Resources */ = {isa = PBXBuildFile; fileRef = 3E75A9851742DBE700DA412D /* CustomPathImages */; }; 4314D1AA1D0E1181004B36C9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4314D1A91D0E1181004B36C9 /* main.m */; }; @@ -42,8 +42,6 @@ 537612B0155AB74D005750A4 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 537612AF155AB74D005750A4 /* DetailViewController.m */; }; 537612B3155AB74D005750A4 /* MasterViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 537612B1155AB74D005750A4 /* MasterViewController.xib */; }; 537612B6155AB74D005750A4 /* DetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 537612B4155AB74D005750A4 /* DetailViewController.xib */; }; - 53A2B50D155B155A00B12423 /* placeholder.png in Resources */ = {isa = PBXBuildFile; fileRef = 53A2B50B155B155A00B12423 /* placeholder.png */; }; - 53A2B50E155B155A00B12423 /* placeholder@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 53A2B50C155B155A00B12423 /* placeholder@2x.png */; }; DA248D44195470FD00390AB0 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 537612E3155ABA3C005750A4 /* MapKit.framework */; }; /* End PBXBuildFile section */ @@ -160,7 +158,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 32892E301FAE898C00BE8320 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 32892E301FAE898C00BE8320 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 32892E341FAE89FD00BE8320 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; 3E75A9851742DBE700DA412D /* CustomPathImages */ = {isa = PBXFileReference; lastKnownFileType = folder; path = CustomPathImages; sourceTree = SOURCE_ROOT; }; 4314D1A61D0E1181004B36C9 /* SDWebImage TV Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "SDWebImage TV Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -212,8 +210,6 @@ 537612B5155AB74D005750A4 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/DetailViewController.xib; sourceTree = ""; }; 537612E3155ABA3C005750A4 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; 537612E6155ABA44005750A4 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; - 53A2B50B155B155A00B12423 /* placeholder.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = placeholder.png; sourceTree = ""; }; - 53A2B50C155B155A00B12423 /* placeholder@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "placeholder@2x.png"; sourceTree = ""; }; DA248D6C1954841D00390AB0 /* SDWebImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDWebImage.xcodeproj; path = ../SDWebImage.xcodeproj; sourceTree = ""; }; /* End PBXFileReference section */ @@ -389,7 +385,7 @@ 537612B1155AB74D005750A4 /* MasterViewController.xib */, 537612B4155AB74D005750A4 /* DetailViewController.xib */, 32892E341FAE89FD00BE8320 /* LaunchScreen.storyboard */, - 32892E301FAE898C00BE8320 /* Images.xcassets */, + 32892E301FAE898C00BE8320 /* Assets.xcassets */, 537612A0155AB74D005750A4 /* Supporting Files */, ); path = "SDWebImage Demo"; @@ -401,8 +397,6 @@ 537612A1155AB74D005750A4 /* SDWebImage Demo-Info.plist */, 537612A5155AB74D005750A4 /* main.m */, 537612A7155AB74D005750A4 /* SDWebImage Demo-Prefix.pch */, - 53A2B50B155B155A00B12423 /* placeholder.png */, - 53A2B50C155B155A00B12423 /* placeholder@2x.png */, ); name = "Supporting Files"; sourceTree = ""; @@ -652,10 +646,8 @@ files = ( 537612B3155AB74D005750A4 /* MasterViewController.xib in Resources */, 537612B6155AB74D005750A4 /* DetailViewController.xib in Resources */, - 53A2B50D155B155A00B12423 /* placeholder.png in Resources */, - 32892E311FAE898C00BE8320 /* Images.xcassets in Resources */, + 32892E311FAE898C00BE8320 /* Assets.xcassets in Resources */, 32892E351FAE89FE00BE8320 /* LaunchScreen.storyboard in Resources */, - 53A2B50E155B155A00B12423 /* placeholder@2x.png in Resources */, 3E75A9861742DBE700DA412D /* CustomPathImages in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Examples/SDWebImage Demo/Images.xcassets/AppIcon.appiconset/Contents.json b/Examples/SDWebImage Demo/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from Examples/SDWebImage Demo/Images.xcassets/AppIcon.appiconset/Contents.json rename to Examples/SDWebImage Demo/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/Examples/SDWebImage Demo/Assets.xcassets/Contents.json b/Examples/SDWebImage Demo/Assets.xcassets/Contents.json new file mode 100644 index 00000000..da4a164c --- /dev/null +++ b/Examples/SDWebImage Demo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/Contents.json b/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/Contents.json new file mode 100644 index 00000000..239724e4 --- /dev/null +++ b/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "placeholder.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "placeholder@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Examples/SDWebImage Demo/placeholder.png b/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/placeholder.png similarity index 100% rename from Examples/SDWebImage Demo/placeholder.png rename to Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/placeholder.png diff --git a/Examples/SDWebImage Demo/placeholder@2x.png b/Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/placeholder@2x.png similarity index 100% rename from Examples/SDWebImage Demo/placeholder@2x.png rename to Examples/SDWebImage Demo/Assets.xcassets/placeholder.imageset/placeholder@2x.png diff --git a/Examples/SDWebImage Demo/DetailViewController.m b/Examples/SDWebImage Demo/DetailViewController.m index 83a2d248..29656a5c 100644 --- a/Examples/SDWebImage Demo/DetailViewController.m +++ b/Examples/SDWebImage Demo/DetailViewController.m @@ -36,8 +36,6 @@ { if (!_progressView) { _progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; - _progressView.frame = CGRectMake(0, CGRectGetMaxY(self.navigationController.navigationBar.frame), CGRectGetWidth(self.view.frame), 2.0); - _progressView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; [self.view addSubview:_progressView]; } return _progressView; @@ -75,6 +73,12 @@ [self configureView]; } +- (void)viewDidLayoutSubviews +{ + [super viewDidLayoutSubviews]; + self.progressView.frame = CGRectMake(0, self.topLayoutGuide.length, CGRectGetWidth(self.view.bounds), 2.0); +} + - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);