//ViewController.m
@//UI常用控件
//Created by lanou on 16/7/10.
//Copyright @2016年lanou.All rights reserved.
//按鈕
#import "viewController.h"
@interface ViewController()
//標(biāo)題標(biāo)簽
@property(nonatomic,strong)UILabel,*text;
//按鈕標(biāo)簽
@property(nonatomic,strong)UiButton*button1,*button2;
@property(nonatomic,strong)UIImage *image;
@property(nonatomic,strong)UIImageView*imageview;
@property(nonatomic,strong)NSArray*array;
@end
@implementation ViewController
-(void)viewDidLoad{
[super viewDIdLoad];
//Do any additional setup after loading the view,typically from a nib.
[self demo];
}
-(void)btnClickLister2{
NSinteger n=[self.array indexOdObject:self.label.text];
//不是最后一張的情況下打開一張
if(n==4)
self.button2.userInteractionEnabled=NO;
if(n>0&&n<4)
{self.button1.userInteractionEnabled=YES;}
if(n==0){
self.button2.userInteractionEnabled=YES;
}
if(n+1==4||n==4)
[self.text setText:@""];
if(n>4){
NSLog(@"打開下一張圖片“)驶忌;
n++;
switch(n){
case 0 : [self.imageview setInage:[UIImage ImageNamed:self.array[0]];[self.label setText:@"biaoqingdi"];break;
case1 : [self.imageview setInage:[UIImage ImageNamed:self.array[1]];[self.label setText:@"bingli"];
[self.button1 setBackgroundImage:[UIImage imageNamed:@"left_normal"]forState:UIControlStateNormal];break;
case 2 : [self.imageview setInage:[UIImage ImageNamed:self.array[2]];[self.label setText:@"chiniupa"];break;
case3 : [self.imageview setInage:[UIImage ImageNamed:self.array[3]];[self.label setText:@"danteng"];break;
case 4 : [self.imageview setInage:[UIImage ImageNamed:self.array[4]];[self.button1 setBackgroundImage:[UIImage imageNamed:@"right_disable"]forState:UIControlStateNormal];[self.label setText:@"wangba"];
NSLog(@"已經(jīng)是最后一張");
self.button.userInteractionEnabled =NO;
}
}
-(void)btnClickLister1{
//獲取當(dāng)前第幾張圖片