iOS Learning-Tom Cat

Source: Internet
Author: User

yjviewcontroller.m//04-Tom Cat's understanding////Created by Jacky-mac on 15-5-31.//Copyright (c) 2015 www.train.com. All rights reserved.//#import "YJViewController.h" @interface Yjviewcontroller () @property (weak, nonatomic) Iboutlet Uiimageview *tom; @end @implementation yjviewcontroller-(void) Tomanimationwithname: (NSString *) name AndCount: (                Nsinteger) count{if ([Self.tom isanimating]) return;        Number of animated pictures nsmutablearray *arraym = [Nsmutablearray array]; Add an animated picture for (int i=0; i<count; i++) {//image name NSString *imagename = [NSString Strin                gwithformat:@ "%@_%02d.jpg", name,i];        NSString *path = [[NSBundle mainbundle] Pathforresource:imagename Oftype:nil];                UIImage *image = [UIImage Imagewithcontentsoffile:path];    [Arraym Addobject:image];            }//Set animation array self.tom.animationImages = Arraym;            Repeat 1 times self.tom.animationRepeatCount = 1; Animation Duration Self.tom.animationDuration = Self.tom.animationImages.count * 0.075;            Start animation [Self.tom startanimating]; After the animation "ends", clean up the animated array [Self.tom performselector: @selector (setanimationimages:) Withobject:nil Afterdelay    : Self.tom.animationDuration]; }/*-(ibaction) tomaction: (UIButton *) sender{//Currenttitle can take out the current caption text of the button [self tomAnimationWithName:sender.cur Renttitle AndCount:sender.tag];} */-(ibaction) knockout{[self tomanimationwithname:@ "knockout" andcount:81];} -(ibaction) eat{[self tomanimationwithname:@ "eat" andcount:40];} -(ibaction) cymbal{[self tomanimationwithname:@ "cymbal" andcount:12];} -(ibaction) drink{[self tomanimationwithname:@ "drink" andcount:80];} -(ibaction) fart{[self tomanimationwithname:@ "fart" andcount:27];} -(ibaction) pie{[self tomanimationwithname:@ "pie" andcount:23];} -(ibaction) scratch{[self tomanimationwithname:@ "Scratch" andcount:55];} -(ibaction) stomach{[self tomanimationwithname:@ "stomach" andcount:34];} - (ibaction) footleft{[self tomanimationwithname:@ "footleft" andcount:30];} -(ibaction) footright{[self tomanimationwithname:@ "footright" andcount:30];} @end

iOS Learning-Tom Cat

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.