• 大小: 989KB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2021-05-14
  • 语言: 其他
  • 标签: 视图动画  

资源简介

启动图加载gif动画

资源截图

代码片段和文件信息

//
//  AppDelegate.m
//  Ad
//
//  Created by mac on 2017/2/17.
//  Copyright © 2017年 mac. All rights reserved.
//

#import “AppDelegate.h“
#import “UIImage+GIF.h“
#import “ViewController.h“
@interface AppDelegate ()
  @property (nonatomic  strong)UIImageView *adView ;
@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
      self.window = [[UIWindow alloc]initWithframe:[UIScreen mainScreen].bounds];
    self.window.rootViewController = [[ViewController alloc] init];
     [self.window makeKeyAndVisible];

    self.adView = [[UIImageView alloc] initWithframe:self.window.bounds];
    [self.window addSubview: self.adView ];
    NSString  *name = @“demo.gif“;
    NSString  *filePath = [[NSBundle bundleWithPath:[[NSBundle mainBundle] bundlePath]] pathForResource:name ofType:nil];
    
    NSData  *imageData = [NSData dataWithContentsOfFile:filePath];
    
    self.adView.image = [UIImage sd_animatedGIFWithData:imageData];
    
    
    CABasicAnimation *animation=[CABasicAnimation animationWithKeyPath:@“transform.scale“];
    self.adView .layer.anchorPoint = CGPointMake(.5.5);
    animation.fillMode=kCAFillModeForwards;
    animation.removedOnCompletion = NO;
    [animation setAutoreverses:NO];
    
    //动画时间
    animation.duration=5;
    animation.delegate=self;
    
    [self.adView.layer addAnimation:animation forKey:@“scale“];
    // Override point for customization after application launch.
    return YES;
}
-(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
    [self.adView  removeFromSuperview];
}

- (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 invalidate graphics rendering callbacks. 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 active 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 previou

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-02-17 10:13  Ad\
     文件        6148  2017-02-17 10:12  Ad\.DS_Store
     目录           0  2017-02-17 10:13  __MACOSX\
     目录           0  2017-02-17 10:13  __MACOSX\Ad\
     文件         120  2017-02-17 10:12  __MACOSX\Ad\._.DS_Store
     目录           0  2017-02-17 10:12  Ad\Ad\
     文件        6148  2017-02-17 10:12  Ad\Ad\.DS_Store
     目录           0  2017-02-17 10:13  __MACOSX\Ad\Ad\
     文件         120  2017-02-17 10:12  __MACOSX\Ad\Ad\._.DS_Store
     文件         262  2017-02-17 09:30  Ad\Ad\AppDelegate.h
     文件         171  2017-02-17 09:30  __MACOSX\Ad\Ad\._AppDelegate.h
     文件        3275  2017-02-17 10:10  Ad\Ad\AppDelegate.m
     文件         696  2017-02-17 10:10  __MACOSX\Ad\Ad\._AppDelegate.m
     目录           0  2017-02-17 09:44  Ad\Ad\Assets.xcassets\
     目录           0  2017-02-17 09:30  Ad\Ad\Assets.xcassets\AppIcon.appiconset\
     文件        1495  2017-02-17 09:30  Ad\Ad\Assets.xcassets\AppIcon.appiconset\Contents.json
     文件          62  2017-02-17 09:37  Ad\Ad\Assets.xcassets\Contents.json
     目录           0  2017-02-17 09:44  Ad\Ad\Assets.xcassets\LaunchImage.launchimage\
     文件        1161  2017-02-17 09:44  Ad\Ad\Assets.xcassets\LaunchImage.launchimage\Contents.json
     文件      116709  2017-02-17 09:44  Ad\Ad\Assets.xcassets\LaunchImage.launchimage\launch3.5.png
     文件      133631  2017-02-17 09:44  Ad\Ad\Assets.xcassets\LaunchImage.launchimage\launch4.0.png
     文件      164335  2017-02-17 09:44  Ad\Ad\Assets.xcassets\LaunchImage.launchimage\launch4.7.png
     文件      339972  2017-02-17 09:44  Ad\Ad\Assets.xcassets\LaunchImage.launchimage\launch5.5.png
     目录           0  2017-02-17 09:34  Ad\Ad\base.lproj\
     文件        1847  2017-02-17 09:34  Ad\Ad\base.lproj\LaunchScreen.storyboard
     目录           0  2017-02-17 10:13  __MACOSX\Ad\Ad\base.lproj\
     文件         293  2017-02-17 09:34  __MACOSX\Ad\Ad\base.lproj\._LaunchScreen.storyboard
     文件        1689  2017-02-17 09:30  Ad\Ad\base.lproj\Main.storyboard
     文件         171  2017-02-17 09:30  __MACOSX\Ad\Ad\base.lproj\._Main.storyboard
     文件      197999  2016-05-24 13:42  Ad\Ad\demo.gif
     文件         216  2016-05-24 13:42  __MACOSX\Ad\Ad\._demo.gif
............此处省略90个文件信息

评论

共有 条评论