@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
--------------- ViewController.m ---------------
#import <Foundation/Foundation.h>
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UILabel *indexLabel;
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UILabel *infoLabel;
@property (nonatomic, assign) int index;
@property (weak, nonatomic) IBOutlet UIButton *rightBtn;
@property (weak, nonatomic) IBOutlet UIButton *leftBtn;
@property (nonatomic, strong) NSArray *datas;
- (IBAction)nextImage;
- (IBAction)preImage;
-(void)changeImage;
@end
@implementation ViewController
-(void)viewDidLoad
{
[super viewDidLoad];
NSDictionary *d1 = @{@"icon":@"biaoqingdi", @"desc":@"在他面前,其他神马表情都弱爆了!"};
NSDictionary *d2 = @{@"icon":@"bingli", @"desc":@"这也忒狠了"};
NSDictionary *d3 = @{@"icon":@"chiniupa", @"desc":@"这小姑娘吃个牛排比杀牛还费劲啊"};
NSDictionary *d4 = @{@"icon":@"danteng", @"desc":@"亲,你能改下你的网名吗"};
NSDictionary *d5 = @{@"icon":@"wangba", @"desc":@"哥们为什么选八号呢"};
self.datas = @[d1,d2,d3,d4,d5];
[self nextImage];
}
-(void)changeImage
{
self.indexLabel.text = [NSString stringWithFormat:@"%d/%zd",self.index, self.datas.count];
NSDictionary *data = self.datas[self.index-1];
self.imageView.image = [UIImage imageNamed:data[@"icon"]];
self.infoLabel.text = data[@"desc"];
self.leftBtn.enabled = self.index != 1;
self.rightBtn.enabled = self.index != self.datas.count;
}
- (IBAction)nextImage
{
self.index++;
[self changeImage];
}
- (IBAction)preImage
{
self.index--;
[self changeImage];
}
@end
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);