//
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)