//AFN函数 — imageview载入网络图片而且获取图片,获取之后存储到手机
  [image
setImageWithURLRequest:[NSURLRequest
requestWithURL:[NSURL
URLWithString:[NSString
stringWithFormat:@"%@",skin.bigImg]]
] placeholderImage:nil
success:^(NSURLRequest
*request,
NSHTTPURLResponse *response,
UIImage *image) {
        UIImageWriteToSavedPhotosAlbum(image,
self,
@selector(image:didFinishSavingWithError:contextInfo:),
nil);
- (void)image:(UIImage
*)image didFinishSavingWithError:(NSError
*)error contextInfo:(void
*)contextInfo

{

    if
(error) {

        [self
showToastWithText:@"不同意保存"];

    }else{

        [self
showToastWithText:@"保存成功"];

    }
}

_player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:file] error:nil];

//            NSLog(@"%@",[NSURL fileURLWithPath:file]);

//            [_player play];

//audioplayer第三方类库播放文件

            AudioPlayer
*player = [AudioPlayer
sharePlayer];
            [player
playWithDataSourceType:DataSourceTypeLocal
withURLString:file];

   
//下载文件


            NSString
*string = [NSString
stringWithFormat:HERO_SOUND_DESC_URL,pathName,fileName];

            NSURL
*url = [NSURL
URLWithString:[string
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

            NSURLRequest
*request = [NSURLRequest
requestWithURL:url];

           

            AFHTTPRequestOperation
*operation = [[AFHTTPRequestOperation
alloc]
initWithRequest:request];

            operation.inputStream
= [NSInputStream
inputStreamWithURL:url];

            operation.outputStream
= [NSOutputStream
outputStreamToFileAtPath:file
append:NO];

            [operation
setCompletionBlockWithSuccess:^(AFHTTPRequestOperation
*operation,
id responseObject) {

                NSLog(@"下载成功");

                [_tableview
reloadData];

            } failure:^(AFHTTPRequestOperation
*operation,
NSError *error) {

                NSLog(@"下载失败");

            }];
            [operation
start];
//在停止滑动的时候将scrollview的缩放变为1倍
-(void)scrollViewDidEndDecelerating:(UIScrollView
*)scrollView

{
    _pageIndex = scrollView.contentOffset.x/SCREEN_WIDTH;
   

    for
(UIScrollView
*scrollview
in scrollView.subviews)

    {

        if
([scrollview isKindOfClass:[UIScrollView
class]]) {
            [scrollview
setZoomScale:1.0];
        }

    }

    HeroSkin
*skin = [_heroskin
objectAtIndex:_pageIndex];

    _namelabel.text
= skin.name;

    _pricelabel.text
= skin.price;

    _pagelabel.text
= [NSString
stringWithFormat:@"%ld of %lu",_pageIndex+1,(unsigned
long)_heroskin.count];

    NSLog(@"%ld",(long)_pageIndex);
}

//图片摇动

-(void)ImageShake

{

    CABasicAnimation
*basic = [CABasicAnimation
animationWithKeyPath:@"transform.rotation.z"];

    basic.fromValue
= [NSNumber
numberWithFloat:-M_PI/16];

    basic.toValue
= [NSNumber
numberWithFloat:M_PI/16];

    basic.duration
=
0.1;

    basic.repeatCount
=
3;
    [imageview.layer
addAnimation:basic
forKey:@"animateLayer"];
//震动一次
    AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
}

//检測motion

-(void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent
*)event

{

    if
(motion == UIEventSubtypeMotionShake) {

        [self
ImageShake];

        [player
play];

    }
}

//计算string字符串的frame大小

-(CGSize)getStringRect:(NSString
*)str

{

    if
(str.length<1) {

        return
CGSizeMake(0,
0);

    }

    CGSize
size;

    NSAttributedString
*string = [[NSAttributedString
alloc]initWithString:str];

    //    NSDictionary *attribute= @{NSFontAttributeName:@12};

    size = [string boundingRectWithSize:CGSizeMake(280,
500)
options:NSStringDrawingTruncatesLastVisibleLine
|

            NSStringDrawingUsesLineFragmentOrigin
|

            NSStringDrawingUsesFontLeading
context:nil].size;

    return
size;
}

-(CGFloat)caculateLabelHeightWith:(float)fontsize
String:(NSString
*)str

{

    UIFont
*font = [UIFont
systemFontOfSize:fontsize];

    CGSize
size = CGSizeMake(300,700);

    CGSize
descriptionSize = [str
sizeWithFont:font
constrainedToSize:size
lineBreakMode:NSLineBreakByWordWrapping];

    return
descriptionSize.height;
}

lol盒子重点内容的更多相关文章

  1. C#重点内容之:委托(delegate)

    为了记忆方便,提取了重点. 委托类似于指针,可以理解为函数指针的升级版,这是理解委托最关键的地方. Action和Func 系统自带的两种委托: Action Func Action型委托要求委托的目 ...

  2. 计算机四级网络工程师--《操作系统(Operating System)》重点内容学习

    开篇语 今天开始看<操作系统>,没办法,计算机网络技术还算有点底子.至于操作系统要不是以前看过一些这方面的书籍,以及上学期学了单片机工作原理,我估计我真的是懵逼的!所幸,在网上找的233网 ...

  3. Postman 官网教程,重点内容,翻译笔记,

    json格式的提交数据需要添加:Content-Type :application/x-www-form-urlencoded,否则会导致请求失败 1. 创建 + 测试: 创建和发送任何的HTTP请求 ...

  4. 老男孩最新Python全栈开发视频教程(92天全)重点内容梳理笔记 看完就是全栈开发工程师

    为什么要写这个系列博客呢? 说来讽刺,91年生人的我,同龄人大多有一份事业,或者有一个家庭了.而我,念了次985大学,年少轻狂,在大学期间迷信创业,觉得大学里的许多课程如同吃翔一样学了几乎一辈子都用不 ...

  5. css基础重点内容总结

    一.目录引入 ./同级(当前) ../上级目录  ../../上上级目录 二.标签种类: 1.块级标签(block):独占一行,宽高可设: 2.行内块标签(inline-block):不独占一行,宽高 ...

  6. C#重点内容之:接口(interface)(一)网络初级示例

    这一篇来源于网络,简单介绍了接口的概念 接口是体现面向对象编程思想优越性的一件利器,为什么这么说呢? 首先我们来看,接口是为继承而存在的,如果没有继承,那就自然不需要接口了,既然有继承,那就需要把可能 ...

  7. 一文带你了解 Flink Forward 柏林站全部重点内容

    前言 2019.10.7~9号,随着70周年国庆活动的顺利闭幕,Flink Forward 也照例在他们的发源地柏林举办了第五届大会.虽然还没有拿到具体的数据,不过从培训门票已经在会前销售一空的这样的 ...

  8. 《Clean Code》重点内容总结

    读书笔记请见Github博客:http://wuxichen.github.io/Myblog/reading/2014/10/06/CleanCode.html

  9. C#重点内容之:事件(Event)

    一.事件的五个组成部分 事件的五个部分: 事件拥有者(对象) 事件成员(Event ,成员) 事件的响应者(对象) 事件处理器(成员,本质是一个回调方法) 事件订阅——把事件处理器与事件关联在一起 二 ...

随机推荐

  1. C语言cgi(1)

    1Columbia Universitycs3157 – Advanced ProgrammingSummer 2014, Lab #2, 60ish pointsJune 9, 2014Follow ...

  2. update和saveOrUpdate具体解释

    在Hibernate中,最核心的概念就是对PO的状态管理.一个PO有三种状态:  1.未被持久化的VO  此时就是一个内存对象VO,由JVM管理生命周期  2.已被持久化的PO,而且在Session生 ...

  3. 设计模式(一)工厂模式Factory(创建类型)

    设计模式一 工厂模式Factory 在面向对象编程中, 最通常的方法是一个new操作符产生一个对象实例,new操作符就是用来构造对象实例的.可是在一些情况下, new操作符直接生成对象会带来一些问题. ...

  4. .net机试题总结

    1.下面是一个由*号组成的4行倒三角形图案.要求:1.输入倒三角形的行数,行数的取值3-21之间,对于非法的行数,要求抛出提示“非法行数!”:2.在屏幕上打印这个指定了行数的倒三角形. ******* ...

  5. 7、Cocos2dx 3.0游戏开发找小三之3.0版本号的代码风格

    重开发人员的劳动成果,转载的时候请务必注明出处:http://blog.csdn.net/haomengzhu/article/details/27691337 Cocos2d-x代码风格 前面我们已 ...

  6. JavaHTTP下载视频

    控制层类: package com.grab.video.controller; import java.io.BufferedOutputStream; import java.io.Buffere ...

  7. 相关Jquery Validator采用

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs& ...

  8. 【Web探索之旅】第一部分:什么是Web?

    内容简介 1.Web探索之旅:开宗明义 2.第一部分第一课:什么是Web? 3.第一部分第二课:Web,服务和云 4.第一部分第三课:Web的诞生史 Web探索之旅:开宗明义 大家好. 我们这个系列课 ...

  9. 发现SQL Server惊天大秘密!!

    原文:发现SQL Server惊天大秘密!! --set statistics xml onCREATE TABLE T_TEST(ID INT IDENTITY PRIMARY KEY,Create ...

  10. 玩转Web之Jsp(一)-----jsp中的静态包含(<%@include file="url"%>)与动态包含(<jsp:include>)

    在jsp中include有两种形式,其中<%@include file="url"%>是指令元素,<jsp:include page="" f ...