iOS drop rebound effect

Source: Internet
Author: User

////HOMEPAGEVIEWCONTROLLER.M//Parkingproject////Created by Eric on 16/10/13.//copyright©2016 years Eric. All rights reserved.//#import "HomePageViewController.h"@interfaceHomepageviewcontroller () @property (nonatomic,strong) UIButton*Navibutton;@end@implementationHomepageviewcontroller-(void) Viewwillappear: (BOOL) animated{[Super viewwillappear:animated]; Self.naviButton.hidden=YES;}-(void) Viewdidappear: (BOOL) animated{[Super viewdidappear:animated]; [Self handlecaspringanimation];}- (void) viewdidload {[Super viewdidload]; //Do any additional setup after loading the view.Self.navibutton =[UIButton Buttonwithtype:uibuttontypecustom]; Self.naviButton.frame= CGRectMake (kdevicewidth/2-Ten, $, the, -); [Self.navibutton settitle:@"Animation"Forstate:uicontrolstatenormal];    [Self.navibutton Setbackgroundcolor:[uicolor Orangecolor];   [Self.view AddSubview:self.naviButton]; }-(void) handlecaspringanimation{cgrect Screen=[UIScreen mainscreen].bounds; Catransform3d Move=catransform3didentity; CGFloat initalertviewyposition= (cgrectgetheight (screen) + cgrectgetheight (_navibutton.frame))/2; Move= Catransform3dmaketranslation (0,-initalertviewyposition,0); Move= Catransform3drotate (Move, +* m_pi/ the,0,0,1.0f); _navibutton.layer.transform=move; [UIView animatewithduration:1.0fDelay:0.0fusingspringwithdamping:0.4finitialspringvelocity:0.0foptions:uiviewanimationoptioncurvelinear Animations:^{Self.naviButton.hidden=NO; Catransform3d Init=catransform3didentity; _navibutton.layer.transform=Init; } Completion:^(BOOL finished) {}]; }- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.    }-(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (Uievent *)Event{[self handlecaspringanimation];}/*#pragma mark-navigation//in a storyboard-based application, you'll often want to do a little preparation before n avigation-(void) Prepareforsegue: (Uistoryboardsegue *) Segue Sender: (ID) Sender {//Get the new view controller using [s]    Egue Destinationviewcontroller]. Pass the selected object to the new view controller.}*/@end

The key code is as above.

iOS drop rebound effect

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.