美文网首页
OC语言学习习得

OC语言学习习得

作者: 妳要等我 | 来源:发表于2016-07-12 21:17 被阅读0次

/  ViewController.m

//访问系统相册

//

//  Created by lanou on 16/7/12.

//  Copyright © 2016年pingguo. All rights reserved.

//

#import"ViewController.h"

//遵守协议

@interfaceViewController()

@property(nonatomic,strong)UIButton*userbtn;

@end

@implementationViewController

- (void)viewDidLoad {

[superviewDidLoad];

//所有的能看得到的ui控件创建初始化方式都可以采用alloc  initWithFrame

self.userbtn=[[UIButtonalloc]initWithFrame:CGRectMake(160,60,80,80)];

//设置颜色

self.userbtn.backgroundColor=[UIColorredColor];

//设置圆形半径

self.userbtn.layer.cornerRadius=40;

self.userbtn.layer.masksToBounds=YES;

//添加点击事件:去访问系统相册

[self.userbtnaddTarget:selfaction:@selector(setUserImage)forControlEvents:(UIControlEventTouchUpInside)];

//将按钮添加到屏幕上面来

[self.viewaddSubview:self.userbtn];

}

//访问系统相册

-(void)setUserImage

{

UIImagePickerController*imagePicker=[[UIImagePickerControlleralloc]init];

//设置代理,到@interface后面遵守协议

imagePicker.delegate=self;

[selfpresentViewController:imagePickeranimated:YEScompletion:nil];

}

//这个方法是协议UIImagePickerControllerDelegate里面的,选择图片结束的时候就会自动调用

- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(nullableNSDictionary *)editingInfo

{

//设置头像

[self.userbtnsetBackgroundImage:imageforState:(UIControlStateNormal)];

//将系统相册消失掉

[pickerdismissViewControllerAnimated:YEScompletion:nil];

}

- (void)didReceiveMemoryWarning {

[superdidReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

@end

- (IBAction)drink:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"drink"withCount:81];

/*  NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<81; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"drink_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=80*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];   */

}

- (IBAction)pie:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"pie"withCount:24];

/*  NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<24; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"pie_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=24*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];    */

}

- (IBAction)scratch:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"scratch"withCount:56];

/*     NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<56; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"scratch_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=56*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];   */

}

- (IBAction)fart:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"fart"withCount:28];

/*    NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<28; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"fart_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=28*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];   */

}

- (IBAction)cymbal:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"cymbal"withCount:13];

/*   NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<13; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"cymbal_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=13*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];    */

}

- (IBAction)knockout:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"knockout"withCount:81];

/*   NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<81; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"knockout_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=81*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];    */

}

- (IBAction)angry:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"angry"withCount:26];

/*  NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<26; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"angry_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=26*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];    */

}

- (IBAction)stomach:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"stomach"withCount:34];

/*  NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<34; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"stomach_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=34*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];    */

}

- (IBAction)footleft:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"footLeft"withCount:30];

/*  NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<30; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"footLeft_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=30*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];*/

}

- (IBAction)footright:(UIButton*)sender {

[selfsetTomCatAnimationWithName:@"footRight"withCount:30];

/* NSMutableArray  *images=[NSMutableArray   array];

for (NSInteger  i=0; i<30; i++) {

NSString  *imageName=[NSString  stringWithFormat:@"footRight_%02ld.jpg",i];

UIImage  *image=[UIImage  imageNamed:imageName];

[images  addObject:image];

}

self.tomCatView.animationImages=images;

self.tomCatView.animationDuration=30*0.075;

self.tomCatView.animationRepeatCount=1;

[self.tomCatView startAnimating];  */

}

- (void)didReceiveMemoryWarning {

[superdidReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

@end

相关文章

  • OC语言学习习得

    / ViewController.m //访问系统相册 // // Created by lanou on 16/...

  • 气盛则文辞兼宜——day3

    内隐学习模块:不知不觉的学习,例如语言学习。 自主心智:通过进化与内隐习得,还包括情感化反应,学习习得的自动化反应...

  • 语言习得和语言学习有什么区别?

    首先纠正一个普遍的错误观念,大家从字面意思上可能认为“语言学习”是过程,“语言习得”是语言学习的结果。其实从语言学...

  • OC编程

    OC语言学习路线及重难点 关键字 数据类型 对象存储细节 Xcode文档安装和自定义代码段 动态数据类型id 构造...

  • 语言学习的好习惯

    家长需支持引导孩子的学习,以下语言学习习惯供参考。 1、培养英文思维:平时让孩子朗读时,只要说英文,中文在脑子里明...

  • 幼儿英语启蒙——第二语言习得论的关键期

    什么是第二语言习得论? 幼儿的语言学习主要有两种方式,即学得(Learning)和习得(Acquisition)。...

  • 认知语言学主要理论框架

    认知语言学主要理论框架 认知,简单来说是知识的习得和使用,是一个内在的心理过程。而认知语言学,作为语言科学和认知科...

  • 语言学习的5个原则

    本文介绍的语言学习原则是多语言习得者龙飞虎的TED演讲《6个月学会任何一种外语》中语言学习原则的总结。 Focus...

  • 博士转去语言学吧

    博士想读读语言学 而不是个别语言学,比如韩语语言学,日语语言学 二硕士可以再读一个个别语言学——英语语言学 25岁...

  • 少儿英语:“习得”和“学得”的区别终于讲明白了!

    从语言学理论上来说,语言学习的方法大致可以划分为两类:“习得”与“学得”。很多家长对此傻傻分不清楚,实际上学会分清...

网友评论

      本文标题:OC语言学习习得

      本文链接:https://www.haomeiwen.com/subject/vcdsjttx.html