Likes and likes

Source: Internet
Author: User

Likes and likes

<Span style = "color: # ffff99; background-color: rgb (255,204,204);"> // ClickZanHelper. m // LJECClickZan /// Created by xiaoyao on 14/11/26. // Copyright (c) 2014 lijien. all rights reserved. // # import "ClickZanHelper. h "# import <UIKit/UIKit. h> @ implementation ClickZanHelper + (void) clickChangeWithButtonImageNormal :( NSString *) imageNameNormal imageNameSelsected :( NSString *) imageNameSelsected receuveBtn :( U IButton *) receuveBtn clickCount :( NSUInteger) count {[receuveBtn setImage: [UIImage imageNamed: count % 2 = 0? ImageNameSelsected: imageNameNormal] forState: UIControlStateNormal]; // implements the use of Key Frame Animation CAKeyframeAnimation * keyAnimation = [CAKeyframeAnimation animationWithKeyPath: @ "transform. scale "]; keyAnimation. values = @ [@ (0.1), @ (1.0), @ (1.5)]; keyAnimation. keyTimes = @ [@ (0.0), @ (0.5), @ (0.8), @ (1.0)]; keyAnimation. calculationMode = kCAAnimationLinear; count ++; [receuveBtn. layer addAnimation: keyAnimation forKey: @ "SHOW"]; return ;}@ end // ClickZanViewController. m // LJECClickZan /// Created by xiaoyao on 14/11/26. // Copyright (c) 2014 lijien. all rights reserved. // # import "ClickZanViewController. h "# import" ClickZanHelper. h "@ interface ClickZanViewController () {NSUInteger I; UIButton * _ imageBtn;} @ end @ implementation ClickZanViewController-(void) viewDidLoad {[super viewDidLoad]; _ imageBtn = [UIButton: parameters]; [_ imageBtn setFrame: CGRectMake (140,150, 80, 30)]; [_ imageBtn setImage: [UIImage imageNamed: @ "profile_btn_unlike"] forState: UIControlStateNormal]; [self. view addSubview: _ imageBtn]; UIButton * clickBtn = [UIButton buttonWithType: UIButtonTypeCustom]; [clickBtn setFrame: CGRectMake (140,200, 80, 30)]; clickBtn. backgroundColor = [UIColor blueColor]; [clickBtn setTitle: @ "like" forState: UIControlStateNormal]; [clickBtn addTarget: self action: @ selector (clickBtnZan :) forControlEvents: role]; [self. view addSubview: clickBtn]; return;}-(void) clickBtnZan :( UIButton *) btn {[ClickZanHelper listener: @ "listener" listener: @ "listener" receuveBtn: _ imageBtn clickCount: i]; I ++; return ;}@ end </span>

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.