标签:style blog http color os 2014
#import "FisrtViewController.h" #import "ViewController.h" @interface FisrtViewController () @end @implementation FisrtViewController - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; //添加一个图片 UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)]; imageView.image=[UIImage imageNamed:@"bg_03"]; [self.view addSubview:imageView]; //添加第一字的按钮 UIButton *diYiZiBtn=[UIButton buttonWithType:UIButtonTypeCustom]; diYiZiBtn.frame=CGRectMake(24, 64, 100, 40); [diYiZiBtn setImage:[UIImage imageNamed: @"WA~0001"] forState:UIControlStateNormal]; [diYiZiBtn addTarget:self action:@selector(diYiZi) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:diYiZiBtn]; //添加第2字的按钮 UIButton *di2ZiBtn=[UIButton buttonWithType:UIButtonTypeCustom]; di2ZiBtn.frame=CGRectMake(214, 64, 100, 40); [di2ZiBtn setImage:[UIImage imageNamed: @"TA~0001"] forState:UIControlStateNormal]; [di2ZiBtn addTarget:self action:@selector(di2Zi) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:di2ZiBtn]; } - (void)diYiZi { ViewController *diYiZiViewContl=[[ViewController alloc]init]; diYiZiViewContl.title=@"1"; [self.navigationController pushViewController:diYiZiViewContl animated:YES]; } - (void)di2Zi { ViewController *di2ZiViewContl=[[ViewController alloc]init]; di2ZiViewContl.title=@"2"; [self.navigationController pushViewController:di2ZiViewContl animated:YES]; } // // ViewController.m // 外文语音-0714 // // Created by apple on 14-7-14. // Copyright (c) 2014年 戴维营教育. All rights reserved. // #import "ViewController.h" #import <AudioToolbox/AudioToolbox.h> @interface ViewController () { UIImageView *biHuaImageView; SystemSoundID soundID; SystemSoundID soundID2; } @end @implementation ViewController - (void)backgView { UIImageView *imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 44, 320, 418)]; imageView.image=[UIImage imageNamed:@"kanaDetailBgImg"]; [self.view addSubview:imageView]; UIImageView *imageView1=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 49)]; imageView1.image=[UIImage imageNamed:@"titleView"]; [self.view addSubview:imageView1]; UIImageView *imageView2=[[UIImageView alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height-49, 320, 49)]; imageView2.image=[UIImage imageNamed:@"bottomBg"]; [self.view addSubview:imageView2]; UIImageView *lianXiImage=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"practiceBtn_01"]]; lianXiImage.frame=CGRectMake(110, 10, 90, 30); [imageView1 addSubview:lianXiImage]; } - (void)button { UIButton *backBtn=[UIButton buttonWithType:UIButtonTypeCustom]; backBtn.frame=CGRectMake(10, 4, 100, 30); [backBtn setImage:[UIImage imageNamed:@"backBtn"] forState:UIControlStateNormal]; [backBtn addTarget:self action:@selector(backclike:) forControlEvents:UIControlEventTouchUpInside ]; [self.view addSubview:backBtn]; UIButton *backBtn1=[UIButton buttonWithType:UIButtonTypeCustom]; backBtn1.frame=CGRectMake(210, 4, 100, 30); [backBtn1 setImage:[UIImage imageNamed:@"clearBtn"] forState:UIControlStateNormal]; [backBtn1 addTarget:self action:@selector(backclike2:) forControlEvents:UIControlEventTouchUpInside ]; [self.view addSubview:backBtn1]; #pragma mark-发音按钮 UIButton *yuYinBtn=[UIButton buttonWithType:UIButtonTypeCustom]; yuYinBtn.frame=CGRectMake(10,self.view.frame.size.height-40, 100, 30); [yuYinBtn setImage:[UIImage imageNamed:@"pronounceBtn_01"] forState:UIControlStateNormal]; [yuYinBtn setImage:[UIImage imageNamed:@"pronounceBtn_02"] forState:UIControlStateHighlighted]; [yuYinBtn addTarget:self action:@selector(yuYinBtn:) forControlEvents:UIControlEventTouchUpInside ]; [self.view addSubview:yuYinBtn]; #pragma mark-笔画按钮 UIButton *biHuaBtn=[UIButton buttonWithType:UIButtonTypeCustom]; biHuaBtn.frame=CGRectMake(110,self.view.frame.size.height-40, 100, 30); [biHuaBtn setImage:[UIImage imageNamed:@"strokeOrderBtn_01"] forState:UIControlStateNormal]; [biHuaBtn setImage:[UIImage imageNamed:@"strokeOrderBtn_02"] forState:UIControlStateHighlighted]; [biHuaBtn addTarget:self action:@selector(biHuaBtn:) forControlEvents:UIControlEventTouchUpInside ]; [self.view addSubview:biHuaBtn]; UIButton *nextBtn=[UIButton buttonWithType:UIButtonTypeCustom]; nextBtn.frame=CGRectMake(210,self.view.frame.size.height-40, 100, 30); [nextBtn setImage:[UIImage imageNamed:@"arrow_right"] forState:UIControlStateNormal]; [nextBtn setImage:[UIImage imageNamed:@"arrow_right"] forState:UIControlStateHighlighted]; [nextBtn addTarget:self action:@selector(nextBtn:) forControlEvents:UIControlEventTouchUpInside ]; [self.view addSubview:nextBtn]; } - (void)biHuaDongHua { if(self.title==@"1") { NSMutableArray *array=[[NSMutableArray alloc]init]; for (int i=1; i<11; i++) { NSString *str=[NSString stringWithFormat:@"WA~%04d",i]; UIImage *image=[UIImage imageNamed:str]; [array addObject:image]; } biHuaImageView=[[UIImageView alloc] initWithFrame:CGRectMake(80, 146,160, 160)]; biHuaImageView.image=[UIImage imageNamed:@"WA~0001"]; biHuaImageView.animationImages=array; biHuaImageView.backgroundColor=[UIColor colorWithRed:0.3 green:0.4 blue:0.5 alpha:0.5]; biHuaImageView.animationDuration=5; biHuaImageView.animationRepeatCount=1; [self.view addSubview:biHuaImageView]; } else { NSMutableArray *array=[[NSMutableArray alloc]init]; for (int i=1; i<13; i++) { NSString *str=[NSString stringWithFormat:@"TA~%04d",i]; UIImage *image=[UIImage imageNamed:str]; [array addObject:image]; } biHuaImageView=[[UIImageView alloc] initWithFrame:CGRectMake(80, 146,160, 160)]; biHuaImageView.image=[UIImage imageNamed:@"TA~0001"]; biHuaImageView.animationImages=array; biHuaImageView.backgroundColor=[UIColor colorWithRed:0.3 green:0.4 blue:0.5 alpha:0.5]; biHuaImageView.animationDuration=5; biHuaImageView.animationRepeatCount=1; [self.view addSubview:biHuaImageView]; } } - (void)backclike:(UIButton *)sender { NSLog(@"%s",__PRETTY_FUNCTION__); } - (void)nextBtn:(UIButton *)sender { NSLog(@"%s",__PRETTY_FUNCTION__); CGAffineTransform transform; if (biHuaImageView.tag == 0) { //transform = CGAffineTransformMakeTranslation(biHuaImageView.frame.origin.x, 100.0); transform = CGAffineTransformScale(biHuaImageView.transform, 2, 1.8); // [biHuaImageView setTag:1]; [biHuaImageView setTag:1]; } else { // transform = CGAffineTransformMakeTranslation(0, 0); transform = CGAffineTransformScale(biHuaImageView.transform, 1/2.0, 1/1.8); [biHuaImageView setTag:0]; } [biHuaImageView setTransform:transform]; } - (void)backclike2:(UIButton *)sender { NSLog(@"%s",__PRETTY_FUNCTION__); } - (void)yuYinBtn:(UIButton *)sender { NSLog(@"%s",__PRETTY_FUNCTION__); if (self.title==@"1") { AudioServicesPlaySystemSound(soundID); } else { AudioServicesPlaySystemSound(soundID2); } } - (void)biHuaBtn:(UIButton *)sender { [biHuaImageView startAnimating]; biHuaImageView.image=[UIImage imageNamed:@"WA~0010"]; NSLog(@"%s",__PRETTY_FUNCTION__); } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self backgView]; [self button]; [self biHuaDongHua]; NSURL *url=[[NSBundle mainBundle] URLForResource:@"053_he" withExtension:@"mp3"]; AudioServicesCreateSystemSoundID((__bridge CFURLRef)(url), &soundID); NSURL *url2=[[NSBundle mainBundle] URLForResource:@"010_ka" withExtension:@"mp3"]; AudioServicesCreateSystemSoundID((__bridge CFURLRef)(url2), &soundID2); }
标签:style blog http color os 2014
原文地址:http://www.cnblogs.com/lidongq/p/3849562.html