Simple use of catransition

Source: Internet
Author: User

//
// Mjviewcontroller. m
// 08-core animation 04-catransition
//
// Created by Apple on 14-4-21.
// Copyright (c) 2014 itcast. All rights reserved.
//

# Import "mjviewcontroller. H"

@ Interface mjviewcontroller ()

// Upload
-(Ibaction) Previous;

// Next
-(Ibaction) next;
@ Property (weak, nonatomic) iboutlet uiimageview * iconview;

/**
* Index of the current image
*/
@ Property (nonatomic, assign) int index;
@ End

@ Implementation mjviewcontroller

-(Ibaction) Previous {
Self. Index --;
If (self. Index =-1 ){
Self. Index = 8;
}

Nsstring * filename = [nsstring stringwithformat: @ "mongod.jpg", self. index + 1];
Self. iconview. Image = [uiimage imagenamed: Filename];

Catransition * anim = [catransition animation];
// Anim. type = @ "cube ";
// Anim. Subtype = kcatransitionfromleft;
Anim. type = @ "pageuncurl ";
Anim. duration= 0.5;
[Self. View. layer addanimation: anim forkey: Nil];
}

-(Ibaction) Next {
Self. Index ++;
If (self. Index = 9 ){
Self. Index = 0;
}

Nsstring * filename = [nsstring stringwithformat: @ "mongod.jpg", self. index + 1];
Self. iconview. Image = [uiimage imagenamed: Filename];

// Transfer Animation
Catransition * anim = [catransition animation];
Anim. type = @ "pagecurl ";
// Anim. type = kcatransition
// Anim. Subtype = kcatransitionfromright;
Anim. duration= 0.5;

// Animation start point
// Anim. startprogress = 0.0;
//
// Animation end point
// Anim. endprogress = 0.5;

[Self. View. layer addanimation: anim forkey: Nil];
}
@ End

Simple use of catransition

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.