diff --git a/AOTutorial.podspec b/AOTutorial.podspec new file mode 100644 index 0000000..0702e25 --- /dev/null +++ b/AOTutorial.podspec @@ -0,0 +1,27 @@ +Pod::Spec.new do |s| + + s.name = "AOTutorial" + s.version = "1.2" + s.summary = "A tutorial component with fade in / fade out animation for background images" + + s.description = <<-DESC + A customizable drop-in solution for iOS application introduction screens. Useful for explaining the application to new users or force initial actions (such as registration). + +Screen pagination includes a cross transition based on scrollview content offset for clean and beautiful page transitions. + +Each page in the introduction have a customizable background image, header text and description text that is optionally truncated if over 3 lines long. + +Additional customization include company/service logo on top of the pages. + +Integrated with action buttons - a Dismiss button or a Signup/login button to link with your application interface naturally. + DESC + + s.homepage = "https://github.com/Appsido/AOTutorial.git" + s.license = 'MIT' + s.author = { "Loïc Griffié" => "lgriffie@appsido.com" } + s.platform = :ios, '5.0' + s.source = { :git => "https://github.com/Appsido/AOTutorial.git", :tag => "1.2" } + s.source_files = 'src' + s.requires_arc = true + +end diff --git a/AOTutorialDemo.xcodeproj/project.pbxproj b/AOTutorialDemo.xcodeproj/project.pbxproj index bf5dbd0..3b8f639 100644 --- a/AOTutorialDemo.xcodeproj/project.pbxproj +++ b/AOTutorialDemo.xcodeproj/project.pbxproj @@ -35,6 +35,7 @@ F337C491180C17CF002BA770 /* bg_5@2x.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F337C483180C17CF002BA770 /* bg_5@2x.jpg */; }; F337C499180C2477002BA770 /* OSI-logo.png in Resources */ = {isa = PBXBuildFile; fileRef = F337C498180C2477002BA770 /* OSI-logo.png */; }; F337C49B180C2502002BA770 /* OSI-logo@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F337C49A180C2502002BA770 /* OSI-logo@2x.png */; }; + F39FE5F0181FC377002FBF8A /* AOTutorial.podspec in Resources */ = {isa = PBXBuildFile; fileRef = F39FE5EF181FC377002FBF8A /* AOTutorial.podspec */; }; F3A647D4180C53C700AAF798 /* AOTutorialViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F3A647D2180C53C700AAF798 /* AOTutorialViewController.m */; }; F3A647D5180C53C700AAF798 /* AOTutorialViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F3A647D3180C53C700AAF798 /* AOTutorialViewController.xib */; }; /* End PBXBuildFile section */ @@ -83,6 +84,7 @@ F337C483180C17CF002BA770 /* bg_5@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "bg_5@2x.jpg"; sourceTree = ""; }; F337C498180C2477002BA770 /* OSI-logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "OSI-logo.png"; sourceTree = ""; }; F337C49A180C2502002BA770 /* OSI-logo@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "OSI-logo@2x.png"; sourceTree = ""; }; + F39FE5EF181FC377002FBF8A /* AOTutorial.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AOTutorial.podspec; sourceTree = ""; }; F3A647D1180C53C700AAF798 /* AOTutorialViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AOTutorialViewController.h; path = src/AOTutorialViewController.h; sourceTree = SOURCE_ROOT; }; F3A647D2180C53C700AAF798 /* AOTutorialViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AOTutorialViewController.m; path = src/AOTutorialViewController.m; sourceTree = SOURCE_ROOT; }; F3A647D3180C53C700AAF798 /* AOTutorialViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = AOTutorialViewController.xib; path = src/AOTutorialViewController.xib; sourceTree = SOURCE_ROOT; }; @@ -115,6 +117,7 @@ F337C435180C1731002BA770 = { isa = PBXGroup; children = ( + F39FE5EF181FC377002FBF8A /* AOTutorial.podspec */, F337C475180C17C6002BA770 /* LICENSE */, F337C476180C17C6002BA770 /* README.md */, F337C473180C17C0002BA770 /* Config.plist */, @@ -298,6 +301,7 @@ files = ( F337C490180C17CF002BA770 /* bg_5.jpg in Resources */, F337C48D180C17CF002BA770 /* bg_3@2x.jpg in Resources */, + F39FE5F0181FC377002FBF8A /* AOTutorial.podspec in Resources */, F337C44C180C1731002BA770 /* InfoPlist.strings in Resources */, F337C499180C2477002BA770 /* OSI-logo.png in Resources */, F3A647D5180C53C700AAF798 /* AOTutorialViewController.xib in Resources */, diff --git a/src/AOTutorialViewController.m b/src/AOTutorialViewController.m index 864fe00..c78c8d2 100644 --- a/src/AOTutorialViewController.m +++ b/src/AOTutorialViewController.m @@ -221,10 +221,12 @@ - (void)addInformationsLabels NSUInteger index = 0; for (NSDictionary *labels in self.informationLabels) { - CGSize hSize = ACMStringSize([labels valueForKey:@"Header"], CGSizeMake((self.view.frame.size.width - (headerLeftMargin * 2)), 60.0f), [self headerTextStyleAttributes]); - CGSize lSize = ACMStringSize([labels valueForKey:@"Label"], CGSizeMake((self.view.frame.size.width - (labelLeftMargin * 2)), 60.0f), [self labelTextStyleAttributes]); + CGSize hSize = ACMStringSize([labels valueForKey:@"Header"], CGSizeMake(([[UIScreen mainScreen] bounds].size.width - (headerLeftMargin * 2)), 60.0f), [self headerTextStyleAttributes]); + CGSize lSize = ACMStringSize([labels valueForKey:@"Label"], CGSizeMake(([[UIScreen mainScreen] bounds].size.width - (labelLeftMargin * 2)), 60.0f), [self labelTextStyleAttributes]); - UILabel *header = [[UILabel alloc] initWithFrame:CGRectMake(0.0f + (self.view.frame.size.width * index) + headerLeftMargin, self.view.frame.size.height - 120.0f - lSize.height, (self.view.frame.size.width - (headerLeftMargin * 2)), hSize.height + 5.0f)]; + NSLog(@"Frame > %@", NSStringFromCGRect(self.scrollview.frame)); + + UILabel *header = [[UILabel alloc] initWithFrame:CGRectMake(0.0f + ([[UIScreen mainScreen] bounds].size.width * index) + headerLeftMargin, [[UIScreen mainScreen] bounds].size.height - 120.0f - lSize.height, ([[UIScreen mainScreen] bounds].size.width - (headerLeftMargin * 2)), hSize.height + 5.0f)]; [header setNumberOfLines:1]; [header setLineBreakMode:NSLineBreakByTruncatingTail]; [header setShadowOffset:CGSizeMake(1, 1)]; @@ -236,7 +238,7 @@ - (void)addInformationsLabels [header setFont:[UIFont fontWithName:headerFontType size:headerFontSize]]; [self.scrollview addSubview:header]; - UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f + (self.view.frame.size.width * index) + labelLeftMargin, header.frame.origin.y + hSize.height + 5.0f, (self.view.frame.size.width - (labelLeftMargin * 2)), lSize.height)]; + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f + ([[UIScreen mainScreen] bounds].size.width * index) + labelLeftMargin, header.frame.origin.y + hSize.height + 5.0f, ([[UIScreen mainScreen] bounds].size.width - (labelLeftMargin * 2)), lSize.height)]; [label setNumberOfLines:0]; [label setLineBreakMode:NSLineBreakByWordWrapping]; [label setShadowOffset:CGSizeMake(1, 1)]; @@ -317,7 +319,7 @@ - (IBAction)dismiss:(id)sender - (void)scrollViewDidScroll:(UIScrollView *)scrollView { - CGFloat alpha = [scrollView contentOffset].x / [self.view frame].size.width - _index; + CGFloat alpha = [scrollView contentOffset].x / [[UIScreen mainScreen] bounds].size.width - _index; NSInteger newIndex = (alpha < 0 ? _index-1 : _index+1); diff --git a/src/AOTutorialViewController.xib b/src/AOTutorialViewController.xib index 2da4324..909e988 100644 --- a/src/AOTutorialViewController.xib +++ b/src/AOTutorialViewController.xib @@ -1,7 +1,7 @@ - + - + @@ -24,22 +24,22 @@ - + - + - +