Code to create a picture rotation; How to define a control as a property when creating a control

Source: Internet
Author: User

Code Create picture Playback

#import "ViewController.h"

#define KLENGTH the

@interface Viewcontroller ()

@property (nonatomic, weak) Uiimageview *myimage;

@property (nonatomic, weak) UILabel *mylabel;

@property (nonatomic,weak) UISlider *myslider;

@end

@implementation Viewcontroller

-(void) Viewdidload {

[Super viewdidload];

// Create Image Control

//1 Creating Controls

uiimageview *myimg= [[uiimageview alloc]init ];

Self. myimage = myimg;

//2 Adding Controls

[Self. View addsubview:self. MyImage];

//3 Set Button Position

Self. myimage. frame = cgrectmake(a) ;

//4 the default state property

Self. myimage. image = [UIImage imagenamed:@ "0"];

// Create lable Control record number of pages

//1 Creating Controls

UILabel *mylbl = [[UILabel alloc]init];

Self. MyLabel = mylbl;

//2 Adding Controls

[Self. View addsubview:self. MyLabel];

//3 Set Control position

Self. MyLabel. frame = cgrectmake(a) ;

//4 the default state property

Self. MyLabel. text = [nsstring stringwithformat:@ "0/%d",klength];

Self. MyLabel. textalignment = Nstextalignmentcenter;

// Create Progress Control

//1 Creating Controls

uislider *myslid = [[uislider alloc]init];

Self. Myslider = myslid ;

//2 Adding Controls

[Self. View addsubview:self. Myslider];

//3 Set Control position

Self. Myslider. frame = cgrectmake(+, 260, +) ;

//4 Adding listener Events

[Self. Myslider addTarget: self Action:@selector(btnslider) forcontrolevents: Uicontroleventvaluechanged];

//5 the default state property

Self. Myslider. MinimumValue = 0;

Self. Myslider. MaximumValue = klength;

}

-(void) Btnslider

{

//slider The current value takes an integer

nsstring *nowvalue = [nsstring stringwithformat:@ "%.F",self. Myslider. value];

Self. MyLabel. text = [nsstring stringwithformat:@ "%@/%d", Nowvalue, klength] ;

Self. myimage. image = [UIImage imagenamed: Nowvalue];

}

@end

Code to create a picture rotation; How to define a control as a property when creating a control

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.