Finally:
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvchjlx2vtaw5lbnq=/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">
BeyondViewController.h
beyondviewcontroller.h// 05_tomcat//// Created by Beyond on 14-7-23.// Copyright (c) 2014 Com.beyond. All rights reserved.//#import <UIKit/UIKit.h> @interface Beyondviewcontroller: Uiviewcontroller@property (Weak, nonatomic) Iboutlet Uiimageview *imgview_tom;-(ibaction) BtnClick: (UIButton *) sender ; @end
Beyondviewcontroller.m
beyondviewcontroller.m//05_tomcat////Created by Beyond on 14-7-23.//Copyright (c) 2014 Com.beyond. All rights reserved.//#import "BeyondViewController.h" @interface Beyondviewcontroller () {nsdictionary *_dict;} @end @implementation beyondviewcontroller-(void) viewdidload{[Super Viewdidload]; Sg_bundle template code, 1, get. App Basic Package, 2, return the FullPath full path of a file in the basic package nsbundle *mainbundle = [NSBundle mainbundle]; NSString *fullpath = [Mainbundle pathforresource:@ "Tom.plist" oftype:nil]; _dict = [Nsdictionary Dictionarywithcontentsoffile:fullpath]; }-(ibaction) Btnclick: (UIButton *) Sender {//assuming being animated, return directly if ([_imgview_tom isanimating]) {return; }//button above the text is the dictionary key, the corresponding value-1 is the corresponding animation picture number//NSString *text = Sender.titleLabel.text; NSString *text = [Sender titleforstate:uicontrolstatenormal]; int *picnum = [_dict[text] intvalue]; NSLog (@ "%@----%d", text,picnum); Call your own definition method to play the animation [self playanimatitonnamed:text picnumber:picnum];}-(void) playanimatitonnamed: (NSString *) name Picnumber: (int) picnum{//Instantiate variable group Nsmutablearray *array = [Nsmutablearr Ay array]; Add uiimage for (int i=0; i<picnum; i++) to a mutable array {//Generate image Mode 1, memory-resident, heavy pressure, real chance to collapse nsstring *fullname = [N Sstring stringwithformat:@ "%@_%02d.jpg", name,i]; UIImage *img = [UIImage imagenamed:fullname]; Generate image mode 2,io Read full path, run out, do not reside memory//nsstring *fullpath = [[NSBundle mainbundle] Pathforresource:fullname oftype:nil ]; UIImage *IMG2 = [[UIImage alloc] initwithcontentsoffile:fullpath]; Add UIImage to array [addobject:img]; }//Set the animation parameters of the Uiimageview and submit the animation _imgview_tom.animationimages = array; _imgview_tom.animationduration = 0.1*picnum; _imgview_tom.animationrepeatcount = 1; [_imgview_tom startanimating];} @end
Ios_5_ Tom Cat