UIImageView

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    
    UIView *containerView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    containerView.backgroundColor = [UIColor whiteColor];
    [self.window addSubview:containerView];
    [containerView release];
    //做动态图
    
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 375, 667)];
    
    //指定展示图片
//    imageView.image = [UIImage imageNamed:@"angry_00.jpg"];
    NSMutableArray *mArr = [NSMutableArray arrayWithCapacity:0];
    for (int i = 0; i < 10; i++) {
        //获取图片名称
        NSString *picStr = [NSString stringWithFormat:@"btn_%02d.jpg",i];
        //获取每一张图片对象
        UIImage *image = [UIImage imageNamed:picStr];
        [mArr addObject:image];
    }
    //指定做动画的所有图片
    imageView.animationImages = mArr;
    
    //指定动画时间,动画重复次数
    imageView.animationDuration = 11 * 0.05;
    imageView.animationRepeatCount = 0;
    
    [imageView startAnimating];//开启动画
    [containerView addSubview:imageView];
    [imageView release];
     [self.window makeKeyAndVisible];
    return YES;
}

posted on 2016-02-21 08:16  哥依然帅气  阅读(127)  评论(0编辑  收藏  举报

导航