1 //
2 //CKViewController.m3 //纯代码实现汤姆猫4 //
5 //Created by FrankChen on 14-12-10.6 //Copyright (c) 2014年 diaozhatian. All rights reserved.7 //8
9 #import "CKViewController.h"
10
11 @interfaceCKViewController ()12 {13 //保存所有图片的个数的数据字典
14 NSDictionary *_imageDict;15 }16 //汤姆猫view
17 @property (nonatomic, weak) UIImageView *tomcat;18
19 @end
20
21 @implementationCKViewController22
23
24 - (void)viewDidLoad25 {26 [super viewDidLoad];27
28 //装载图片字典
29 NSBundle *bundle =[NSBundle mainBundle];30 NSString *path = [bundle pathForResource:@"tomcat" ofType:@"plist"];31 _imageDict =[NSDictionary dictionaryWithContentsOfFile:path];32
33 //创建汤姆猫的主界面显示图片
34 UIImageView *mainImage =[[UIImageView alloc] init];35 [self.view addSubview:mainImage];36 self.tomcat =mainImage;37 CGFloat viewW =self.view.frame.size.width;38 CGFloat viewH =self.view.frame.size.height;39 mainImage.frame = CGRectMake(0, 0, viewW, viewH);40 mainImage.image = [UIImage imageNamed:@"angry_00.jpg"];41
42 //创建头部按钮
43 UIButton *headBtn =[[UIButton alloc] init];44 [self.view addSubvie