Repository: JunichiT/JTFadingInfoView Branch: master Commit: a7544c6dddd0 Files: 45 Total size: 134.4 KB Directory structure: gitextract_gdlg0pfg/ ├── .idea/ │ ├── .name │ ├── JTFadingInfoViewController.iml │ ├── codeStyleSettings.xml │ ├── encodings.xml │ ├── misc.xml │ ├── modules.xml │ ├── scopes/ │ │ └── scope_settings.xml │ ├── vcs.xml │ ├── workspace.xml │ └── xcode.xml ├── Example/ │ ├── JTFadingInfoView/ │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj/ │ │ │ └── LaunchScreen.xib │ │ ├── Class/ │ │ │ ├── JTFadingInfoView.h │ │ │ └── JTFadingInfoView.m │ │ ├── Images.xcassets/ │ │ │ ├── AppIcon.appiconset/ │ │ │ │ └── Contents.json │ │ │ ├── LaunchImage.launchimage/ │ │ │ │ └── Contents.json │ │ │ ├── cyan-pentagonal-background.imageset/ │ │ │ │ └── Contents.json │ │ │ └── icon.imageset/ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LogInViewController.h │ │ ├── LogInViewController.m │ │ ├── LogInViewController.xib │ │ ├── PropertyViewController.h │ │ ├── PropertyViewController.m │ │ ├── PropertyViewController.xib │ │ ├── RootViewController.h │ │ ├── RootViewController.m │ │ └── main.m │ ├── JTFadingInfoView.xcodeproj/ │ │ ├── project.pbxproj │ │ ├── project.xcworkspace/ │ │ │ ├── contents.xcworkspacedata │ │ │ ├── xcshareddata/ │ │ │ │ └── JTFadingInfoView.xccheckout │ │ │ └── xcuserdata/ │ │ │ └── DCL_JT.xcuserdatad/ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcuserdata/ │ │ └── DCL_JT.xcuserdatad/ │ │ ├── xcdebugger/ │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes/ │ │ ├── JTFadingInfoViewController.xcscheme │ │ └── xcschememanagement.plist │ └── JTFadingInfoViewTests/ │ ├── Info.plist │ └── JTFadingInfoViewTests.m ├── JTFadingInfoView.podspec ├── LICENSE ├── Pod/ │ ├── Assets/ │ │ └── .gitkeep │ └── Classes/ │ ├── .gitkeep │ ├── JTFadingInfoView.h │ └── JTFadingInfoView.m └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: .idea/.name ================================================ JTFadingInfoViewController ================================================ FILE: .idea/JTFadingInfoViewController.iml ================================================ ================================================ FILE: .idea/codeStyleSettings.xml ================================================ ================================================ FILE: .idea/encodings.xml ================================================ ================================================ FILE: .idea/misc.xml ================================================ ================================================ FILE: .idea/modules.xml ================================================ ================================================ FILE: .idea/scopes/scope_settings.xml ================================================ ================================================ FILE: .idea/vcs.xml ================================================ ================================================ FILE: .idea/workspace.xml ================================================ true CSS Code style issuesJavaScript Control flow issuesJavaScript JavaScript JavaScript function metricsJavaScript JavaScript validity issuesJavaScript Portability issues Potentially confusing code constructsJavaScript Probable bugsCSS Probable bugsJavaScript XPath C/C++ 1438288560104 ================================================ FILE: .idea/xcode.xml ================================================ ================================================ FILE: Example/JTFadingInfoView/AppDelegate.h ================================================ // // AppDelegate.h // JTFadingInfoViewController // // Created by DCL_JT on 2015/07/29. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UIViewController *viewController; @end ================================================ FILE: Example/JTFadingInfoView/AppDelegate.m ================================================ // // AppDelegate.m // JTFadingInfoViewController // // Created by DCL_JT on 2015/07/29. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import "AppDelegate.h" #import "RootViewController.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; RootViewController *rootVC = [[RootViewController alloc] init]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:rootVC]; [navController setNavigationBarHidden:YES animated:YES]; self.viewController = navController; self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } @end ================================================ FILE: Example/JTFadingInfoView/Base.lproj/LaunchScreen.xib ================================================ ================================================ FILE: Example/JTFadingInfoView/Class/JTFadingInfoView.h ================================================ // // JTFadingInfoView.h // JTFadingInfoView // // Created by Junichi Tsurukawa on 2015/07/29. // // The MIT License (MIT) // Copyright (c) 2015 Junichi Tsurukawa. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import #pragma mark - Fade in/out options typedef enum { JTFadeInDirectionFromAbove = 1, JTFadeInDirectionFromBelow, JTFadeInDirectionFromLeft, JTFadeInDirectionFromRight, JTFadeInDirectionFromPresentPosition } JTFadeInDirectionType; typedef enum { JTFadeOutDirectionToAbove = 1, JTFadeOutDirectionToBelow, JTFadeOutDirectionToLeft, JTFadeOutDirectionToRight, JTFadeOutDirectionToPresentPosition } JTFadeOutDirectionType; typedef enum { JTDisplayDurationInfinity } JTDisplayDurationOption; @interface JTFadingInfoView : UIButton #pragma mark - Initializer /** * Initializes a JTFadingInfoView with a frame and label to be shown on. * * @param frame A CGRect value for this view's frame * @param label A NSString value to use as this view's label * * @return A JTFadingInfoView with frame and label */ - (id)initWithFrame:(CGRect)frame label:(NSString *)label; #pragma mark - Instance Methods /** * appearWithDuration:duration has a role to display JTFadingInfoView for specified time * * @param duration A NSTimeInterval value as a duration time to display JTFadingInfoView */ - (void)appearWithDuration: (NSTimeInterval)duration; /** * disappearFromSuperview has a role to disappear JTFadingInfoView with fading animation. * */ - (void)disappearFromSuperview; #pragma mark - Properties #pragma Shadow /** A Boolean value for whether the shadow effect is enabled or not. */ @property BOOL isShadowEnabled; /** A Boolean value for whether the animation effect is enabled or not. */ @property BOOL isAnimationEnabled; #pragma Animatoins /** A float represeting the time for displaying this view itself (second). If <= 0, view will not disappear */ @property float displayDuration; /** A float representing the time the view is appeared by (second). */ @property float appearingDuration; /** A float representing the time the view is disappeared by (second). */ @property float disappearingDuration; /** A float representing how much the view moves during fading in/out. */ @property float animationMovement; /** A JTFadeInType representing from which direction the view appears */ @property JTFadeInDirectionType fadeInDirection; /** A JTFadeInType representing to which direction the view will be disappeared */ @property JTFadeOutDirectionType fadeOutDirection; @end ================================================ FILE: Example/JTFadingInfoView/Class/JTFadingInfoView.m ================================================ // // JTFadingInfoView.m // JTFadingInfoView // // Created by Junichi Tsurukawa on 2015/07/29. // // The MIT License (MIT) // Copyright (c) 2015 Junichi Tsurukawa. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import "JTFadingInfoView.h" #import @interface JTFadingInfoView () @property CALayer *backgroundShadowLayer; @end @implementation JTFadingInfoView - (id)initWithFrame:(CGRect)frame label:(NSString *)label { self = [self initWithFrame:frame]; [self setTitle:label forState:UIControlStateNormal]; return self; } - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; //NSLog(@"%@", NSStringFromCGRect(self.frame)); // Initial value for each property self.isAnimationEnabled = YES; self.isShadowEnabled = YES; self.backgroundColor = [UIColor colorWithRed:0.f/255.f green:140.f/255.f blue:250.f/255.f alpha:1.0f]; self.titleLabel.textColor = [UIColor whiteColor]; self.titleLabel.textAlignment = NSTextAlignmentCenter; self.alpha = 0.0f; self.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; self.fadeInDirection = JTFadeInDirectionFromBelow; self.fadeOutDirection = JTFadeOutDirectionToBelow; self.animationMovement = 30.0f; self.appearingDuration = 1.0f; self.displayDuration = 3.0f; self.disappearingDuration = 1.0f; // Add touch behavior self.userInteractionEnabled = YES; self.tag = 100; return self; } // tap event listener - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; //NSLog(@"tap pos: %@", touch.) if ( touch.view.tag == self.tag ){ //NSLog(@"Do STG"); [self disappearFromSuperview]; } } // called when addSubview method is fired - (void)willMoveToSuperview:(UIView *)newSuperview { //NSLog(@"willMoveToSuperview called"); [self appearWithDuration:self.displayDuration]; } // appear behavior with animation - (void)appear { // Corner Radius self.layer.cornerRadius = 3.0f; // Add shadow layer like material design if (self.isShadowEnabled) { CALayer *caLayer = self.layer; caLayer.frame = self.frame; caLayer.shadowRadius = 3.0f; caLayer.shadowOpacity = 0.4f; caLayer.shadowOffset = CGSizeMake(0.0f, 3.0f); caLayer.shouldRasterize = YES; // retina screen resolution [caLayer setRasterizationScale:[[UIScreen mainScreen] scale]]; [caLayer setShouldRasterize:YES]; } // Animation //NSLog(@"%d", self.isAnimationEnabled); // Do animation if the property selected YES if (self.isAnimationEnabled) { //NSLog(@"animation appear"); CGRect appearFrom = self.frame; CGRect pos; // fade in behaviors with each property switch (self.fadeInDirection) { case JTFadeInDirectionFromAbove: //NSLog(@"JTFadeInDirectionFromBelow"); appearFrom.origin.y -= self.animationMovement; self.frame = appearFrom; pos = self.frame; pos.origin.y += self.animationMovement; break; case JTFadeInDirectionFromBelow: //NSLog(@"JTFadeInDirectionFromBelow"); appearFrom.origin.y += self.animationMovement; self.frame = appearFrom; pos = self.frame; pos.origin.y -= self.animationMovement; break; case JTFadeInDirectionFromLeft: //NSLog(@"JTFadeInDirectionFromLeft"); appearFrom.origin.x -= self.animationMovement; self.frame = appearFrom; pos = self.frame; pos.origin.x += self.animationMovement; break; case JTFadeInDirectionFromRight: //NSLog(@"JTFadeInDirectionFromRight"); appearFrom.origin.x += self.animationMovement; self.frame = appearFrom; pos = self.frame; pos.origin.x -= self.animationMovement; break; case JTFadeInDirectionFromPresentPosition: //NSLog(@"JTFadeOutDirectionFromPresentPosition"); self.frame = appearFrom; pos = self.frame; break; default: break; } // animation function [UIView animateWithDuration: self.appearingDuration delay: 0.5f options: UIViewAnimationOptionLayoutSubviews animations: ^{ self.alpha = 1.0f; self.frame = pos; } completion:^(BOOL finished) { //NSLog(@"complete"); }]; } // when the property self.isAnimationEnabled is false else { // just set the aplha value to 1.0 immediately self.alpha = 1.0f; } } // appear with display duration - (void)appearWithDuration: (NSTimeInterval)duration { [self appear]; if ( duration > 0 || duration != JTDisplayDurationInfinity) { [self performSelector:@selector(disappearFromSuperview) withObject:nil afterDelay:duration]; } } // disappear behavior with animation - (void)disappearFromSuperview { CGRect pos = self.frame; // fade out behaviors with each property switch (self.fadeOutDirection) { case JTFadeOutDirectionToAbove: //NSLog(@"JTFadeOutDirectionToAbove"); pos.origin.y -= self.animationMovement; break; case JTFadeOutDirectionToBelow: //NSLog(@"JTFadeOutDirectionToBelow"); pos.origin.y += self.animationMovement; break; case JTFadeOutDirectionToLeft: //NSLog(@"JTFadeOutDirectionToLeft"); pos.origin.x -= self.animationMovement; break; case JTFadeOutDirectionToRight: //NSLog(@"JTFadeOutDirectionToRight"); pos.origin.x += self.animationMovement; break; case JTFadeOutDirectionToPresentPosition: //NSLog(@"JTFadeOutDirectionToPresentPosition"); break; default: break; } // Do animation if the property selected YES if (self.isAnimationEnabled) { [UIView animateWithDuration: self.disappearingDuration delay: self.appearingDuration options: UIViewAnimationOptionLayoutSubviews animations: ^{ self.alpha = 0.0f; self.frame = pos; } completion:^(BOOL finished) { //NSLog(@"complete rem"); [self removeFromSuperview]; }]; } // when self.isAnimationEnabled is false else{ // just set aplha to 0 to be invisible, and removeFromSuperview self.alpha = 0.0f; [self removeFromSuperview]; } } @end ================================================ FILE: Example/JTFadingInfoView/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "1x" }, { "idiom" : "ipad", "size" : "29x29", "scale" : "2x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "1x" }, { "idiom" : "ipad", "size" : "40x40", "scale" : "2x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "1x" }, { "idiom" : "ipad", "size" : "76x76", "scale" : "2x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/JTFadingInfoView/Images.xcassets/LaunchImage.launchimage/Contents.json ================================================ { "images" : [ { "orientation" : "portrait", "idiom" : "ipad", "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "2x" }, { "orientation" : "landscape", "idiom" : "ipad", "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "1x" }, { "orientation" : "landscape", "idiom" : "ipad", "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", "minimum-system-version" : "7.0", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "iphone", "minimum-system-version" : "7.0", "subtype" : "retina4", "scale" : "2x" }, { "orientation" : "portrait", "idiom" : "ipad", "minimum-system-version" : "7.0", "extent" : "full-screen", "scale" : "1x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/JTFadingInfoView/Images.xcassets/cyan-pentagonal-background.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal", "scale" : "1x", "filename" : "cyan-pentagonal-background.png" }, { "idiom" : "universal", "scale" : "2x", "filename" : "cyan-pentagonal-background-1.png" }, { "idiom" : "universal", "scale" : "3x", "filename" : "cyan-pentagonal-background-1-1.png" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/JTFadingInfoView/Images.xcassets/icon.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal", "scale" : "1x", "filename" : "icon.png" }, { "idiom" : "universal", "scale" : "2x", "filename" : "icon-1.png" }, { "idiom" : "universal", "scale" : "3x", "filename" : "icon-1-1.png" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/JTFadingInfoView/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier Junichi.$(PRODUCT_NAME:rfc1034identifier) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight ================================================ FILE: Example/JTFadingInfoView/LogInViewController.h ================================================ // // LogInViewController.h // JTFadingInfoView // // Created by DCL_JT on 2015/08/07. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import @interface LogInViewController : UIViewController @property (weak, nonatomic) IBOutlet UIImageView *backGroundImage; @property (weak, nonatomic) IBOutlet UIImageView *frameView; @property (weak, nonatomic) IBOutlet UIButton *closeButton; @property (weak, nonatomic) IBOutlet UITextField *textField; @property (weak, nonatomic) IBOutlet UITextField *passField; @end ================================================ FILE: Example/JTFadingInfoView/LogInViewController.m ================================================ // // LogInViewController.m // JTFadingInfoView // // Created by DCL_JT on 2015/08/07. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import "LogInViewController.h" #import "JTFadingInfoView.h" @interface LogInViewController () @end @implementation LogInViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. self.textField.delegate = self; self.passField.delegate = self; [self.navigationController setNavigationBarHidden:YES animated:YES]; [self.view sendSubviewToBack:self.frameView]; [self.view sendSubviewToBack:self.backGroundImage]; CALayer *caLayer = self.frameView.layer; caLayer.frame = self.frameView.frame; caLayer.cornerRadius = 5.0f; caLayer.shadowRadius = 3.0f; caLayer.shadowOpacity = 0.4f; caLayer.shadowOffset = CGSizeMake(0.0f, 3.0f); } - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } - (IBAction)tapCloseButton:(id)sender { [self.navigationController popViewControllerAnimated:YES]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ - (IBAction)logInPressed:(id)sender { NSString *msg = @"Login Success!"; CGRect frame = CGRectZero; frame.origin.x = self.view.frame.size.width/4; frame.origin.y = self.view.frame.size.height*4/5; frame.size.width = self.view.frame.size.width/2; frame.size.height = 40; JTFadingInfoView *infoView = [[JTFadingInfoView alloc] initWithFrame:frame label:msg]; infoView.appearingDuration = 0.4; [self.view addSubview:infoView]; } @end ================================================ FILE: Example/JTFadingInfoView/LogInViewController.xib ================================================ ================================================ FILE: Example/JTFadingInfoView/PropertyViewController.h ================================================ // // PropertyViewController.h // JTFadingInfoView // // Created by DCL_JT on 2015/08/07. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import @interface PropertyViewController : UIViewController @property (weak, nonatomic) IBOutlet UISegmentedControl *appearDirectionControl; @property (weak, nonatomic) IBOutlet UISegmentedControl *disappearDirectionControl; @property (weak, nonatomic) IBOutlet UITextField *appearingDurationField; @property (weak, nonatomic) IBOutlet UITextField *displayingDurationField; @property (weak, nonatomic) IBOutlet UITextField *disappearingDurationField; @property (weak, nonatomic) IBOutlet UIButton *showInfoViewButton; @end ================================================ FILE: Example/JTFadingInfoView/PropertyViewController.m ================================================ // // PropertyViewController.m // JTFadingInfoView // // Created by DCL_JT on 2015/08/07. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import "PropertyViewController.h" #import "JTFadingInfoView.h" @interface PropertyViewController (){ JTFadingInfoView *infoView; UILabel *subLabel; } @end @implementation PropertyViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self.navigationController setNavigationBarHidden:NO animated:YES]; self.appearingDurationField.delegate = self; self.displayingDurationField.delegate = self; self.disappearingDurationField.delegate = self; self.view.backgroundColor = [UIColor whiteColor]; self.appearingDurationField.text = @"1.5"; self.displayingDurationField.text = @"3.0"; self.disappearingDurationField.text = @"1.5"; // Simplest Call // CGRect frame = CGRectMake(90, 400, 190, 50); // NSString *label = @"JTFadingInfoView!"; // JTFadingInfoView *inforView = [[JTFadingInfoView alloc] initWithFrame:frame // label:label]; // [self.view addSubview:inforView]; } - (void)selectAppearValue { switch (self.appearDirectionControl.selectedSegmentIndex) { case 0: infoView.fadeInDirection = JTFadeInDirectionFromAbove; break; case 1: infoView.fadeInDirection = JTFadeInDirectionFromBelow; break; case 2: infoView.fadeInDirection = JTFadeInDirectionFromLeft; break; case 3: infoView.fadeInDirection = JTFadeInDirectionFromRight; break; case 4: infoView.fadeInDirection = JTFadeInDirectionFromPresentPosition; break; default: break; } } - (void)selectDisappearValue { switch (self.disappearDirectionControl.selectedSegmentIndex) { case 0: infoView.fadeOutDirection = JTFadeOutDirectionToAbove; break; case 1: infoView.fadeOutDirection = JTFadeOutDirectionToBelow; break; case 2: infoView.fadeOutDirection = JTFadeOutDirectionToLeft; break; case 3: infoView.fadeOutDirection = JTFadeOutDirectionToRight; break; case 4: infoView.fadeOutDirection = JTFadeOutDirectionToPresentPosition; break; default: break; } } - (BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } - (IBAction)showInfoView:(id)sender { [self appear]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (void)appear { CGRect screenFrame = [[UIScreen mainScreen] bounds]; CGRect frame = CGRectZero; frame.origin.x = screenFrame.size.width / 4; frame.origin.y = screenFrame.size.height * 4/5; frame.size.width = screenFrame.size.width / 2; frame.size.height = 50; NSString *label = @"Label loaded"; infoView = [[JTFadingInfoView alloc] initWithFrame:frame label:label]; // Custom Parameters infoView.isAnimationEnabled = YES; infoView.isShadowEnabled = YES; infoView.appearingDuration = [self.appearingDurationField.text floatValue]; infoView.displayDuration = [self.displayingDurationField.text floatValue]; infoView.disappearingDuration = [self.disappearingDurationField.text floatValue]; infoView.animationMovement = 40.0f; [self selectAppearValue]; [self selectDisappearValue]; [self.view addSubview:infoView]; } @end ================================================ FILE: Example/JTFadingInfoView/PropertyViewController.xib ================================================ ================================================ FILE: Example/JTFadingInfoView/RootViewController.h ================================================ // // RootViewController.h // JTFadingInfoView // // Created by DCL_JT on 2015/08/07. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import @interface RootViewController : UIViewController @end ================================================ FILE: Example/JTFadingInfoView/RootViewController.m ================================================ // // RootViewController.m // JTFadingInfoView // // Created by DCL_JT on 2015/08/07. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import "RootViewController.h" #import "PropertyViewController.h" #import "LogInViewController.h" @interface RootViewController () @end @implementation RootViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. [self.navigationController setNavigationBarHidden:NO animated:YES]; [self.navigationController setTitle:@"JTFadingInfoView Sample"]; self.view.backgroundColor = [UIColor whiteColor]; CGRect frame = CGRectZero; frame.origin.x = self.view.frame.size.width/4; frame.origin.y = self.view.frame.size.height/3; frame.size.width = self.view.frame.size.width/2; frame.size.height = 50.0; UIButton *propertyDemo = [[UIButton alloc] initWithFrame:frame]; [propertyDemo setTitle:@"Properties Demo" forState:UIControlStateNormal]; [propertyDemo addTarget:self action:@selector(pressedPropertiesDemo) forControlEvents:UIControlEventTouchUpInside]; propertyDemo.backgroundColor = [UIColor blueColor]; CALayer *caPropertyDemoLayer = propertyDemo.layer; caPropertyDemoLayer.frame = propertyDemo.frame; caPropertyDemoLayer.cornerRadius = 5.0f; caPropertyDemoLayer.shadowRadius = 3.0f; caPropertyDemoLayer.shadowOpacity = 0.4f; caPropertyDemoLayer.shadowOffset = CGSizeMake(0.0f, 3.0f); [self.view addSubview:propertyDemo]; frame.origin.y = self.view.frame.size.height * 2/3; UIButton *logInDemo = [[UIButton alloc] initWithFrame:frame]; [logInDemo setTitle:@"Login Demo" forState:UIControlStateNormal]; [logInDemo addTarget:self action:@selector(pressedLogInDemo) forControlEvents:UIControlEventTouchUpInside]; logInDemo.backgroundColor = [UIColor blueColor]; CALayer *caDemoButtonLayer = logInDemo.layer; caDemoButtonLayer.frame = logInDemo.frame; caDemoButtonLayer.cornerRadius = 5.0f; caDemoButtonLayer.shadowRadius = 3.0f; caDemoButtonLayer.shadowOpacity = 0.4f; caDemoButtonLayer.shadowOffset = CGSizeMake(0.0f, 3.0f); [self.view addSubview:logInDemo]; } - (void)viewWillAppear:(BOOL)animated { [self.navigationController setNavigationBarHidden:NO animated:YES]; } - (void)pressedPropertiesDemo { PropertyViewController *propertyDemoVC = [[PropertyViewController alloc] init]; [self.navigationController pushViewController:propertyDemoVC animated:YES]; } - (void)pressedLogInDemo { LogInViewController *logInDemoVC = [[LogInViewController alloc] init]; [self.navigationController pushViewController:logInDemoVC animated:YES]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end ================================================ FILE: Example/JTFadingInfoView/main.m ================================================ // // main.m // JTFadingInfoViewController // // Created by DCL_JT on 2015/07/29. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import #import "AppDelegate.h" int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } ================================================ FILE: Example/JTFadingInfoView.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 56011E751B6D7D4D00A66DB9 /* JTFadingInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = 56011E741B6D7D4D00A66DB9 /* JTFadingInfoView.m */; }; 56011E811B6D7D8400A66DB9 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 56011E7F1B6D7D8400A66DB9 /* Info.plist */; }; 56011E821B6D7D8400A66DB9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 56011E801B6D7D8400A66DB9 /* main.m */; }; 56011E881B6D7EC800A66DB9 /* JTFadingInfoViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 56011E831B6D7D9400A66DB9 /* JTFadingInfoViewTests.m */; }; 56011E891B6D7EF100A66DB9 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 56011E7C1B6D7D7900A66DB9 /* LaunchScreen.xib */; }; 56011E8A1B6D7EF800A66DB9 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 56011E851B6D7D9E00A66DB9 /* Info.plist */; }; 56011E8F1B6D800B00A66DB9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 56011E8E1B6D800B00A66DB9 /* Images.xcassets */; }; 56011E941B6EC49C00A66DB9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 56011E911B6EC49C00A66DB9 /* AppDelegate.m */; }; 56D0A1831B73CB3400F0C5DE /* LogInViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 56D0A1811B73CB3400F0C5DE /* LogInViewController.m */; }; 56D0A1841B73CB3400F0C5DE /* LogInViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 56D0A1821B73CB3400F0C5DE /* LogInViewController.xib */; }; 56D0A1871B73F77C00F0C5DE /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 56D0A1861B73F77C00F0C5DE /* RootViewController.m */; }; 56D0A1921B74B3A000F0C5DE /* PropertyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 56D0A1901B74B3A000F0C5DE /* PropertyViewController.m */; }; 56D0A1931B74B3A000F0C5DE /* PropertyViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 56D0A1911B74B3A000F0C5DE /* PropertyViewController.xib */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ 5669C3A81B67D5FE003A2B83 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 5669C3861B67D5FE003A2B83 /* Project object */; proxyType = 1; remoteGlobalIDString = 5669C38D1B67D5FE003A2B83; remoteInfo = JTFadingInfoViewController; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 56011E731B6D7D4D00A66DB9 /* JTFadingInfoView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JTFadingInfoView.h; path = JTFadingInfoView/Class/JTFadingInfoView.h; sourceTree = SOURCE_ROOT; }; 56011E741B6D7D4D00A66DB9 /* JTFadingInfoView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JTFadingInfoView.m; path = JTFadingInfoView/Class/JTFadingInfoView.m; sourceTree = SOURCE_ROOT; }; 56011E7D1B6D7D7900A66DB9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = JTFadingInfoView/Base.lproj/LaunchScreen.xib; sourceTree = SOURCE_ROOT; }; 56011E7F1B6D7D8400A66DB9 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = JTFadingInfoView/Info.plist; sourceTree = SOURCE_ROOT; }; 56011E801B6D7D8400A66DB9 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = JTFadingInfoView/main.m; sourceTree = SOURCE_ROOT; }; 56011E831B6D7D9400A66DB9 /* JTFadingInfoViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JTFadingInfoViewTests.m; path = JTFadingInfoViewTests/JTFadingInfoViewTests.m; sourceTree = SOURCE_ROOT; }; 56011E851B6D7D9E00A66DB9 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = JTFadingInfoViewTests/Info.plist; sourceTree = SOURCE_ROOT; }; 56011E8E1B6D800B00A66DB9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = JTFadingInfoView/Images.xcassets; sourceTree = SOURCE_ROOT; }; 56011E901B6EC49C00A66DB9 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = JTFadingInfoView/AppDelegate.h; sourceTree = SOURCE_ROOT; }; 56011E911B6EC49C00A66DB9 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = JTFadingInfoView/AppDelegate.m; sourceTree = SOURCE_ROOT; }; 5669C38E1B67D5FE003A2B83 /* JTFadingInfoView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JTFadingInfoView.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5669C3A71B67D5FE003A2B83 /* JTFadingInfoViewTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JTFadingInfoViewTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56D0A1801B73CB3400F0C5DE /* LogInViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LogInViewController.h; path = JTFadingInfoView/LogInViewController.h; sourceTree = SOURCE_ROOT; }; 56D0A1811B73CB3400F0C5DE /* LogInViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LogInViewController.m; path = JTFadingInfoView/LogInViewController.m; sourceTree = SOURCE_ROOT; }; 56D0A1821B73CB3400F0C5DE /* LogInViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = LogInViewController.xib; path = JTFadingInfoView/LogInViewController.xib; sourceTree = SOURCE_ROOT; }; 56D0A1851B73F77C00F0C5DE /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RootViewController.h; path = JTFadingInfoView/RootViewController.h; sourceTree = SOURCE_ROOT; }; 56D0A1861B73F77C00F0C5DE /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RootViewController.m; path = JTFadingInfoView/RootViewController.m; sourceTree = SOURCE_ROOT; }; 56D0A18F1B74B3A000F0C5DE /* PropertyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PropertyViewController.h; path = JTFadingInfoView/PropertyViewController.h; sourceTree = SOURCE_ROOT; }; 56D0A1901B74B3A000F0C5DE /* PropertyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PropertyViewController.m; path = JTFadingInfoView/PropertyViewController.m; sourceTree = SOURCE_ROOT; }; 56D0A1911B74B3A000F0C5DE /* PropertyViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PropertyViewController.xib; path = JTFadingInfoView/PropertyViewController.xib; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 5669C38B1B67D5FE003A2B83 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; 5669C3A41B67D5FE003A2B83 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 5669C3851B67D5FE003A2B83 = { isa = PBXGroup; children = ( 5669C3B71B67D64B003A2B83 /* JTFadingInfoView */, 5669C3901B67D5FE003A2B83 /* Demo */, 5669C3AA1B67D5FE003A2B83 /* JTFadingInfoViewTests */, 5669C38F1B67D5FE003A2B83 /* Products */, ); sourceTree = ""; }; 5669C38F1B67D5FE003A2B83 /* Products */ = { isa = PBXGroup; children = ( 5669C38E1B67D5FE003A2B83 /* JTFadingInfoView.app */, 5669C3A71B67D5FE003A2B83 /* JTFadingInfoViewTests.xctest */, ); name = Products; sourceTree = ""; }; 5669C3901B67D5FE003A2B83 /* Demo */ = { isa = PBXGroup; children = ( 56D0A1881B73F83E00F0C5DE /* Controller */, 56011E901B6EC49C00A66DB9 /* AppDelegate.h */, 56011E911B6EC49C00A66DB9 /* AppDelegate.m */, 56011E7C1B6D7D7900A66DB9 /* LaunchScreen.xib */, 56011E8E1B6D800B00A66DB9 /* Images.xcassets */, 5669C3911B67D5FE003A2B83 /* Supporting Files */, ); name = Demo; path = JTFadingInfoViewController; sourceTree = ""; }; 5669C3911B67D5FE003A2B83 /* Supporting Files */ = { isa = PBXGroup; children = ( 56011E7F1B6D7D8400A66DB9 /* Info.plist */, 56011E801B6D7D8400A66DB9 /* main.m */, ); name = "Supporting Files"; sourceTree = ""; }; 5669C3AA1B67D5FE003A2B83 /* JTFadingInfoViewTests */ = { isa = PBXGroup; children = ( 56011E831B6D7D9400A66DB9 /* JTFadingInfoViewTests.m */, 5669C3AB1B67D5FE003A2B83 /* Supporting Files */, ); name = JTFadingInfoViewTests; path = JTFadingInfoViewControllerTests; sourceTree = ""; }; 5669C3AB1B67D5FE003A2B83 /* Supporting Files */ = { isa = PBXGroup; children = ( 56011E851B6D7D9E00A66DB9 /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; 5669C3B71B67D64B003A2B83 /* JTFadingInfoView */ = { isa = PBXGroup; children = ( 56011E731B6D7D4D00A66DB9 /* JTFadingInfoView.h */, 56011E741B6D7D4D00A66DB9 /* JTFadingInfoView.m */, ); name = JTFadingInfoView; path = JTFadingInfoViewController; sourceTree = ""; }; 56D0A1881B73F83E00F0C5DE /* Controller */ = { isa = PBXGroup; children = ( 56D0A1851B73F77C00F0C5DE /* RootViewController.h */, 56D0A1861B73F77C00F0C5DE /* RootViewController.m */, 56D0A1891B73F85400F0C5DE /* Children */, ); name = Controller; sourceTree = ""; }; 56D0A1891B73F85400F0C5DE /* Children */ = { isa = PBXGroup; children = ( 56D0A1801B73CB3400F0C5DE /* LogInViewController.h */, 56D0A1811B73CB3400F0C5DE /* LogInViewController.m */, 56D0A1821B73CB3400F0C5DE /* LogInViewController.xib */, 56D0A18F1B74B3A000F0C5DE /* PropertyViewController.h */, 56D0A1901B74B3A000F0C5DE /* PropertyViewController.m */, 56D0A1911B74B3A000F0C5DE /* PropertyViewController.xib */, ); name = Children; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 5669C38D1B67D5FE003A2B83 /* JTFadingInfoView */ = { isa = PBXNativeTarget; buildConfigurationList = 5669C3B11B67D5FE003A2B83 /* Build configuration list for PBXNativeTarget "JTFadingInfoView" */; buildPhases = ( 5669C38A1B67D5FE003A2B83 /* Sources */, 5669C38B1B67D5FE003A2B83 /* Frameworks */, 5669C38C1B67D5FE003A2B83 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = JTFadingInfoView; productName = JTFadingInfoViewController; productReference = 5669C38E1B67D5FE003A2B83 /* JTFadingInfoView.app */; productType = "com.apple.product-type.application"; }; 5669C3A61B67D5FE003A2B83 /* JTFadingInfoViewTests */ = { isa = PBXNativeTarget; buildConfigurationList = 5669C3B41B67D5FE003A2B83 /* Build configuration list for PBXNativeTarget "JTFadingInfoViewTests" */; buildPhases = ( 5669C3A31B67D5FE003A2B83 /* Sources */, 5669C3A41B67D5FE003A2B83 /* Frameworks */, 5669C3A51B67D5FE003A2B83 /* Resources */, ); buildRules = ( ); dependencies = ( 5669C3A91B67D5FE003A2B83 /* PBXTargetDependency */, ); name = JTFadingInfoViewTests; productName = JTFadingInfoViewControllerTests; productReference = 5669C3A71B67D5FE003A2B83 /* JTFadingInfoViewTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 5669C3861B67D5FE003A2B83 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0610; ORGANIZATIONNAME = "Junichi Tsurukawa"; TargetAttributes = { 5669C38D1B67D5FE003A2B83 = { CreatedOnToolsVersion = 6.1; }; 5669C3A61B67D5FE003A2B83 = { CreatedOnToolsVersion = 6.1; TestTargetID = 5669C38D1B67D5FE003A2B83; }; }; }; buildConfigurationList = 5669C3891B67D5FE003A2B83 /* Build configuration list for PBXProject "JTFadingInfoView" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 5669C3851B67D5FE003A2B83; productRefGroup = 5669C38F1B67D5FE003A2B83 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 5669C38D1B67D5FE003A2B83 /* JTFadingInfoView */, 5669C3A61B67D5FE003A2B83 /* JTFadingInfoViewTests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 5669C38C1B67D5FE003A2B83 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 56011E811B6D7D8400A66DB9 /* Info.plist in Resources */, 56011E8F1B6D800B00A66DB9 /* Images.xcassets in Resources */, 56011E891B6D7EF100A66DB9 /* LaunchScreen.xib in Resources */, 56D0A1931B74B3A000F0C5DE /* PropertyViewController.xib in Resources */, 56011E8A1B6D7EF800A66DB9 /* Info.plist in Resources */, 56D0A1841B73CB3400F0C5DE /* LogInViewController.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; 5669C3A51B67D5FE003A2B83 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 5669C38A1B67D5FE003A2B83 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 56011E821B6D7D8400A66DB9 /* main.m in Sources */, 56011E751B6D7D4D00A66DB9 /* JTFadingInfoView.m in Sources */, 56D0A1921B74B3A000F0C5DE /* PropertyViewController.m in Sources */, 56D0A1871B73F77C00F0C5DE /* RootViewController.m in Sources */, 56D0A1831B73CB3400F0C5DE /* LogInViewController.m in Sources */, 56011E941B6EC49C00A66DB9 /* AppDelegate.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 5669C3A31B67D5FE003A2B83 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 56011E881B6D7EC800A66DB9 /* JTFadingInfoViewTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ 5669C3A91B67D5FE003A2B83 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 5669C38D1B67D5FE003A2B83 /* JTFadingInfoView */; targetProxy = 5669C3A81B67D5FE003A2B83 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 56011E7C1B6D7D7900A66DB9 /* LaunchScreen.xib */ = { isa = PBXVariantGroup; children = ( 56011E7D1B6D7D7900A66DB9 /* Base */, ); name = LaunchScreen.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 5669C3AF1B67D5FE003A2B83 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.1; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; 5669C3B01B67D5FE003A2B83 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 8.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; }; name = Release; }; 5669C3B21B67D5FE003A2B83 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; INFOPLIST_FILE = "$(SRCROOT)/JTFadingInfoViewTests/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = JTFadingInfoView; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; }; 5669C3B31B67D5FE003A2B83 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; INFOPLIST_FILE = "$(SRCROOT)/JTFadingInfoViewTests/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = JTFadingInfoView; TARGETED_DEVICE_FAMILY = 1; }; name = Release; }; 5669C3B51B67D5FE003A2B83 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = JTFadingInfoViewTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = JTFadingInfoViewTests; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JTFadingInfoView.app/JTFadingInfoView"; }; name = Debug; }; 5669C3B61B67D5FE003A2B83 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", ); INFOPLIST_FILE = JTFadingInfoViewTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = JTFadingInfoViewTests; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/JTFadingInfoView.app/JTFadingInfoView"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 5669C3891B67D5FE003A2B83 /* Build configuration list for PBXProject "JTFadingInfoView" */ = { isa = XCConfigurationList; buildConfigurations = ( 5669C3AF1B67D5FE003A2B83 /* Debug */, 5669C3B01B67D5FE003A2B83 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 5669C3B11B67D5FE003A2B83 /* Build configuration list for PBXNativeTarget "JTFadingInfoView" */ = { isa = XCConfigurationList; buildConfigurations = ( 5669C3B21B67D5FE003A2B83 /* Debug */, 5669C3B31B67D5FE003A2B83 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 5669C3B41B67D5FE003A2B83 /* Build configuration list for PBXNativeTarget "JTFadingInfoViewTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 5669C3B51B67D5FE003A2B83 /* Debug */, 5669C3B61B67D5FE003A2B83 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 5669C3861B67D5FE003A2B83 /* Project object */; } ================================================ FILE: Example/JTFadingInfoView.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Example/JTFadingInfoView.xcodeproj/project.xcworkspace/xcshareddata/JTFadingInfoView.xccheckout ================================================ IDESourceControlProjectFavoriteDictionaryKey IDESourceControlProjectIdentifier 4030E531-F04B-42DF-A82F-EEE89A100072 IDESourceControlProjectName JTFadingInfoView IDESourceControlProjectOriginsDictionary B7A2F78619A7A6FB72F487979EBEA5A525867AC0 https://github.com/JunichiT/JTFadingInfoView.git IDESourceControlProjectPath Example/JTFadingInfoView.xcodeproj IDESourceControlProjectRelativeInstallPathDictionary B7A2F78619A7A6FB72F487979EBEA5A525867AC0 ../../.. IDESourceControlProjectURL https://github.com/JunichiT/JTFadingInfoView.git IDESourceControlProjectVersion 111 IDESourceControlProjectWCCIdentifier B7A2F78619A7A6FB72F487979EBEA5A525867AC0 IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey B7A2F78619A7A6FB72F487979EBEA5A525867AC0 IDESourceControlWCCName JTFadingInfoView ================================================ FILE: Example/JTFadingInfoView.xcodeproj/project.xcworkspace/xcuserdata/DCL_JT.xcuserdatad/WorkspaceSettings.xcsettings ================================================ HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges SnapshotAutomaticallyBeforeSignificantChanges ================================================ FILE: Example/JTFadingInfoView.xcodeproj/xcuserdata/DCL_JT.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist ================================================ ================================================ FILE: Example/JTFadingInfoView.xcodeproj/xcuserdata/DCL_JT.xcuserdatad/xcschemes/JTFadingInfoViewController.xcscheme ================================================ ================================================ FILE: Example/JTFadingInfoView.xcodeproj/xcuserdata/DCL_JT.xcuserdatad/xcschemes/xcschememanagement.plist ================================================ SuppressBuildableAutocreation 5669C38D1B67D5FE003A2B83 primary 5669C3A61B67D5FE003A2B83 primary ================================================ FILE: Example/JTFadingInfoViewTests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIcons CFBundleIcons~ipad CFBundleIdentifier Junichi.$(PRODUCT_NAME:rfc1034identifier) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 UILaunchStoryboardName LaunchScreen UISupportedInterfaceOrientations UIInterfaceOrientationPortrait ================================================ FILE: Example/JTFadingInfoViewTests/JTFadingInfoViewTests.m ================================================ // // JTFadingInfoViewTests.m // JTFadingInfoViewTests // // Created by DCL_JT on 2015/07/29. // Copyright (c) 2015年 Junichi Tsurukawa. All rights reserved. // #import #import @interface JTFadingInfoViewTests : XCTestCase @end @implementation JTFadingInfoViewTests - (void)setUp { [super setUp]; // Put setup code here. This method is called before the invocation of each test method in the class. } - (void)tearDown { // Put teardown code here. This method is called after the invocation of each test method in the class. [super tearDown]; } - (void)testExample { // This is an example of a functional test case. XCTAssert(YES, @"Pass"); } - (void)testPerformanceExample { // This is an example of a performance test case. [self measureBlock:^{ // Put the code you want to measure the time of here. }]; } @end ================================================ FILE: JTFadingInfoView.podspec ================================================ # # Be sure to run `pod lib lint JTFadingInfoView.podspec' to ensure this is a # valid spec and remove all comments before submitting the spec. # # Any lines starting with a # are optional, but encouraged # # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html # Pod::Spec.new do |s| s.name = "JTFadingInfoView" s.version = "1.0.2" s.summary = "A UIButton-based view with fade in/out animation features." s.homepage = "https://github.com/JunichiT/JTFadingInfoView" s.screenshots = "https://raw.githubusercontent.com/JunichiT/JTFadingInfoView/master/Docs/simple.gif" s.license = 'MIT' s.author = { "JunichiTsurukawa" => "j.tsurukawa@gmail.com" } s.source = { :git => "https://github.com/JunichiT/JTFadingInfoView.git", :tag => s.version.to_s } s.platform = :ios, '7.0' s.requires_arc = true s.source_files = 'Pod/Classes/' s.resource_bundles = { 'JTFadingInfoView' => ['Pod/Assets/*.png'] } end ================================================ FILE: LICENSE ================================================ The MIT License (MIT) Copyright (c) 2015 Junichi Tsurukawa . All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Pod/Assets/.gitkeep ================================================ ================================================ FILE: Pod/Classes/.gitkeep ================================================ ================================================ FILE: Pod/Classes/JTFadingInfoView.h ================================================ // // JTFadingInfoView.h // JTFadingInfoView // // Created by Junichi Tsurukawa on 2015/07/29. // // The MIT License (MIT) // Copyright (c) 2015 Junichi Tsurukawa. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import #pragma mark - Fade in/out options typedef enum { JTFadeInDirectionFromAbove = 1, JTFadeInDirectionFromBelow, JTFadeInDirectionFromLeft, JTFadeInDirectionFromRight, JTFadeInDirectionFromPresentPosition } JTFadeInDirectionType; typedef enum { JTFadeOutDirectionToAbove = 1, JTFadeOutDirectionToBelow, JTFadeOutDirectionToLeft, JTFadeOutDirectionToRight, JTFadeOutDirectionToPresentPosition } JTFadeOutDirectionType; typedef enum { JTDisplayDurationInfinity } JTDisplayDurationOption; @interface JTFadingInfoView : UIButton #pragma mark - Initializer /** * Initializes a JTFadingInfoView with a frame and label to be shown on. * * @param frame A CGRect value for this view's frame * @param label A NSString value to use as this view's label * * @return A JTFadingInfoView with frame and label */ - (id)initWithFrame:(CGRect)frame label:(NSString *)label; #pragma mark - Instance Methods /** * appearWithDuration:duration has a role to display JTFadingInfoView for specified time * * @param duration A NSTimeInterval value as a duration time to display JTFadingInfoView */ - (void)appearWithDuration: (NSTimeInterval)duration; /** * disappearFromSuperview has a role to disappear JTFadingInfoView with fading animation. * */ - (void)disappearFromSuperview; #pragma mark - Properties #pragma Shadow /** A Boolean value for whether the shadow effect is enabled or not. */ @property BOOL isShadowEnabled; /** A Boolean value for whether the animation effect is enabled or not. */ @property BOOL isAnimationEnabled; #pragma Animatoins /** A float represeting the time for displaying this view itself (second). If <= 0, view will not disappear */ @property float displayDuration; /** A float representing the time the view is appeared by (second). */ @property float appearingDuration; /** A float representing the time the view is disappeared by (second). */ @property float disappearingDuration; /** A float representing how much the view moves during fading in/out. */ @property float animationMovement; /** A JTFadeInType representing from which direction the view appears */ @property JTFadeInDirectionType fadeInDirection; /** A JTFadeInType representing to which direction the view will be disappeared */ @property JTFadeOutDirectionType fadeOutDirection; @end ================================================ FILE: Pod/Classes/JTFadingInfoView.m ================================================ // // JTFadingInfoView.m // JTFadingInfoView // // Created by Junichi Tsurukawa on 2015/07/29. // // The MIT License (MIT) // Copyright (c) 2015 Junichi Tsurukawa. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #import "JTFadingInfoView.h" #import @interface JTFadingInfoView () @property CALayer *backgroundShadowLayer; @end @implementation JTFadingInfoView - (id)initWithFrame:(CGRect)frame label:(NSString *)label { self = [self initWithFrame:frame]; [self setTitle:label forState:UIControlStateNormal]; return self; } - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; //NSLog(@"%@", NSStringFromCGRect(self.frame)); // Initial value for each property self.isAnimationEnabled = YES; self.isShadowEnabled = YES; self.backgroundColor = [UIColor colorWithRed:0.f/255.f green:140.f/255.f blue:250.f/255.f alpha:1.0f]; self.titleLabel.textColor = [UIColor whiteColor]; self.titleLabel.textAlignment = NSTextAlignmentCenter; self.alpha = 0.0f; self.titleLabel.lineBreakMode = NSLineBreakByWordWrapping; self.fadeInDirection = JTFadeInDirectionFromBelow; self.fadeOutDirection = JTFadeOutDirectionToBelow; self.animationMovement = 30.0f; self.appearingDuration = 1.0f; self.displayDuration = 3.0f; self.disappearingDuration = 1.0f; // Add touch behavior self.userInteractionEnabled = YES; self.tag = 100; return self; } // tap event listener - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [[event allTouches] anyObject]; //NSLog(@"tap pos: %@", touch.) if ( touch.view.tag == self.tag ){ //NSLog(@"Do STG"); [self disappearFromSuperview]; } } // called when addSubview method is fired - (void)willMoveToSuperview:(UIView *)newSuperview { //NSLog(@"willMoveToSuperview called"); [self appearWithDuration:self.displayDuration]; } // appear behavior with animation - (void)appear { // Corner Radius self.layer.cornerRadius = 3.0f; // Add shadow layer like material design if (self.isShadowEnabled) { CALayer *caLayer = self.layer; caLayer.frame = self.frame; caLayer.shadowRadius = 3.0f; caLayer.shadowOpacity = 0.4f; caLayer.shadowOffset = CGSizeMake(0.0f, 3.0f); caLayer.shouldRasterize = YES; // retina screen resolution [caLayer setRasterizationScale:[[UIScreen mainScreen] scale]]; [caLayer setShouldRasterize:YES]; } // Animation //NSLog(@"%d", self.isAnimationEnabled); // Do animation if the property selected YES if (self.isAnimationEnabled) { //NSLog(@"animation appear"); CGRect appearFrom = self.frame; CGRect pos; // fade in behaviors with each property switch (self.fadeInDirection) { case JTFadeInDirectionFromAbove: //NSLog(@"JTFadeInDirectionFromBelow"); appearFrom.origin.y -= self.animationMovement; self.frame = appearFrom; pos = self.frame; pos.origin.y += self.animationMovement; break; case JTFadeInDirectionFromBelow: //NSLog(@"JTFadeInDirectionFromBelow"); appearFrom.origin.y += self.animationMovement; self.frame = appearFrom; pos = self.frame; pos.origin.y -= self.animationMovement; break; case JTFadeInDirectionFromLeft: //NSLog(@"JTFadeInDirectionFromLeft"); appearFrom.origin.x -= self.animationMovement; self.frame = appearFrom; pos = self.frame; pos.origin.x += self.animationMovement; break; case JTFadeInDirectionFromRight: //NSLog(@"JTFadeInDirectionFromRight"); appearFrom.origin.x += self.animationMovement; self.frame = appearFrom; pos = self.frame; pos.origin.x -= self.animationMovement; break; case JTFadeInDirectionFromPresentPosition: //NSLog(@"JTFadeInDirectionFromPresentPosition"); self.frame = appearFrom; pos = self.frame; break; default: break; } // animation function [UIView animateWithDuration: self.appearingDuration delay: 0.5f options: UIViewAnimationOptionLayoutSubviews animations: ^{ self.alpha = 1.0f; self.frame = pos; } completion:^(BOOL finished) { //NSLog(@"complete"); }]; } // when the property self.isAnimationEnabled is false else { // just set the aplha value to 1.0 immediately self.alpha = 1.0f; } } // appear with display duration - (void)appearWithDuration: (NSTimeInterval)duration { [self appear]; if ( duration > 0 || duration != JTDisplayDurationInfinity) { [self performSelector:@selector(disappearFromSuperview) withObject:nil afterDelay:duration]; } } // disappear behavior with animation - (void)disappearFromSuperview { CGRect pos = self.frame; // fade out behaviors with each property switch (self.fadeOutDirection) { case JTFadeOutDirectionToAbove: //NSLog(@"JTFadeOutDirectionToAbove"); pos.origin.y -= self.animationMovement; break; case JTFadeOutDirectionToBelow: //NSLog(@"JTFadeOutDirectionToBelow"); pos.origin.y += self.animationMovement; break; case JTFadeOutDirectionToLeft: //NSLog(@"JTFadeOutDirectionToLeft"); pos.origin.x -= self.animationMovement; break; case JTFadeOutDirectionToRight: //NSLog(@"JTFadeOutDirectionToRight"); pos.origin.x += self.animationMovement; break; case JTFadeOutDirectionToPresentPosition: //NSLog(@"JTFadeOutDirectionToPresentPosition"); break; default: break; } // Do animation if the property selected YES if (self.isAnimationEnabled) { [UIView animateWithDuration: self.disappearingDuration delay: self.appearingDuration options: UIViewAnimationOptionLayoutSubviews animations: ^{ self.alpha = 0.0f; self.frame = pos; } completion:^(BOOL finished) { //NSLog(@"complete rem"); [self removeFromSuperview]; }]; } // when self.isAnimationEnabled is false else{ // just set aplha to 0 to be invisible, and removeFromSuperview self.alpha = 0.0f; [self removeFromSuperview]; } } @end ================================================ FILE: README.md ================================================ ![Title](Docs/JTFadingInfoView_Title.png) # JTFadingInfoView [![Version](https://img.shields.io/cocoapods/v/JTFadingInfoView.svg?style=flat)](http://cocoadocs.org/docsets/JTFadingInfoView) [![License](https://img.shields.io/cocoapods/l/JTFadingInfoView.svg?style=flat)](http://cocoadocs.org/docsets/JTFadingInfoView) [![Platform](https://img.shields.io/cocoapods/p/JTFadingInfoView.svg?style=flat)](http://cocoadocs.org/docsets/JTFadingInfoView) ## Overview `JTFadingInfoView` is google's material design like notification view with smooth fade in/out animation features, based on UIButton subclass. You can select fade in/out direction as you like. Also, customizable properties can be tweaked behaviors and enhance your application UI cool. With this library, you can easily implement floating in-app notification to your app, such as login success/fail notification messages. ![Screen shot](Docs/loginDemo.gif) ## Installation JTFadingInfoView is available on CocoaPods. You can use this library by adding the following command onto your Podfile: ```ruby pod "JTFadingInfoView" ``` ## Usage The simplest setup: ```objective-c CGRect frame = CGRectMake(150, 200, 150, 50); NSString *label = @"JTFadingInfoView!"; JTFadingInfoView *infoView = [[JTFadingInfoView alloc] initWithFrame:frame label:label]; [self.view addSubview:infoView]; ``` ![Screen shot](Docs/simple.gif) ### Customize Behaviors JTFadingInfoView has parameters to customize behaviors as you like: ```objective-c /** A float represeting the time for displaying this view itself (second). /** If <= 0, view will not disappear */ @property float displayDuration; /** A float representing the time the view is appeared by (second). */ @property float appearingDuration; /** A float representing the time the view is disappeared by (second). */ @property float disappearingDuration; /** A float representing how much the view moves during fading in/out. */ @property float animationMovement; /** A JTFadeInType representing from which direction the view appears */ @property JTFadeInDirectionType fadeInDirection; /** A JTFadeInType representing to which direction the view will be disappeared */ @property JTFadeOutDirectionType fadeOutDirection; ``` ![Screen shot](Docs/parameterDemo.gif) ## Change History ### 1.0.0 - First release ### 1.0.1 - Bug Fix ### 1.0.2 - Bug Fix ## Requirements iOS 7.0 or later ## Author Junichi Tsurukawa ## License JTFadingInfoView is available under the MIT license.