iOS Development-image browser (optimized)

Source: Internet
Author: User

//

VIEWCONTROLLER.M

19- Picture Browser

//

Created by Hongqiangli on 2017/7/31.

Copyright Letter and Huimin Investment Management (Beijing) Co., Ltd. All rights reserved.

//

#import "ViewController.h"

@interface viewcontroller ()

/**

record the current index number

*/

@property(nonatomic,assign)int index;

/**

the previous one

*/

-(ibaction) previous;

/**

Next One

*/

-(ibaction) next;

/**

Description

*/

@property (weak, nonatomic) iboutlet UILabel *desclabel;

/**

Previous Button

*/

@property (weak, nonatomic) iboutlet UIButton *previousbtn;

/**

Next button

*/

@property (weak, nonatomic) iboutlet UIButton *nextbtn;

/**

Index label

*/

@property (weak, nonatomic) iboutlet UILabel *nolabel;

@property (weak, nonatomic) iboutlet uiimageview *mainimageview;

@end

@implementation Viewcontroller

-(void) viewdidload {

[Super viewdidload];

[self changdata];

}

/**

Click on the previous one

*/

-(ibaction) Previous {

_index--;

[self changdata];

}

/**

Next One

*/

-(ibaction) Next {

_index+ +;

[self changdata];

}

-(void) changdata{

Switch (_index) {

case 0:

_nolabel. Text = @ "1/5";

_mainimageview. Image = [UIImage imagenamed:@ "Biaoqingdi"];

_desclabel. Text = @ " in front of him, other expressions are weak !" ;

break;

case 1:

_nolabel. Text = @ "2/5";

_mainimageview. Image = [UIImage imagenamed:@ "Wangba"];

_desclabel. Text = @ " Brother why Choose number Eighth ";

break;

case 2:

_nolabel. Text = @ "3/5";

_mainimageview. Image = [UIImage imagenamed:@ "Bingli"];

_desclabel. Text = @ " This is also cruel ";

break;

Case 3:

_nolabel. Text = @ "4/5";

_mainimageview. Image = [UIImage imagenamed:@ "Chiniupa"];

_desclabel. Text = @ " this little girl eats a bull and kills cows. "

break;

Case 4:

_nolabel. Text = @ "5/5";

_mainimageview. Image = [UIImage imagenamed:@ "Danteng"];

_desclabel. Text = @ " Pro, can you change your network name?" Haha ";

break;

default:

break;

}

// judgment button can not click

_previousbtn. Enabled = (_index! = 0);

_nextbtn. Enabled = (_index! = 4);

}

@end

iOS Development-image browser (optimized)

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.