//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. 经典排序算法 - 高速排序Quick sort

    经典排序算法 - 高速排序Quick sort 原理,通过一趟扫描将要排序的数据切割成独立的两部分,当中一部分的全部数据都比另外一部分的全部数据都要小,然后再按此方法对这两部分数据分别进行高速排序,整 ...

  2. 【Android 应用开发】 FastJson 使用具体解释

    博客地址 :http://blog.csdn.net/shulianghan/article/details/41011605 fastjson 源代码地址 : -- GitHub : https:/ ...

  3. J2SE习题(2)

    第四.五周练习题 1.a. Define a class called BlogEntry that could be used to store an entry for a  Weblog. Th ...

  4. centos在设置时区

    [root@localhost ~]# date -R     // 查看时区 Mon, 19 May 2014 10:18:46 +0000 [root@localhost ~]# tzselect ...

  5. _00013 一致性哈希算法 Consistent Hashing 新的讨论,并出现相应的解决

    笔者博文:妳那伊抹微笑 博客地址:http://blog.csdn.net/u012185296 个性签名:世界上最遥远的距离不是天涯,也不是海角,而是我站在妳的面前.妳却感觉不到我的存在 技术方向: ...

  6. Copy-and-swap

    为了在自己定义类里重载一个异常安全(exception safe)的赋值操作符.创造了一个这种习惯用语.也叫:Create-Temporary-and-Swap. 要想写健壮的C++代码.异常安全很重 ...

  7. JSP中的include有哪些?有什么差别?

    JSP中的include有哪些?有什么差别? 1.JSP中的include有哪些 (1)<%@include file="" %> (2)<jsp:include ...

  8. Arcgis for Js之Graphiclayer扩展具体解释

    在前两节,讲到了两种不同方式的聚类,一种是基于距离的,一种是基于区域范围的,两种不同的聚类都是通过扩展esri/layers/GraphicsLayer方法来实现的.在本节,就具体的讲讲esri/la ...

  9. QEMU-KVM自己主动创建虚拟机,以指定IP构造

    正在使用qemu不能指定创建虚拟机的过程IP住址,然而,在实际应用中,我们需要有一台虚拟机IP住址,不是人为的虚拟机操作系统配置. 于qemu虚拟机技术文档(http://qemu.weilnetz. ...

  10. 乐在其中设计模式(C#) - 代理模式(Proxy Pattern)

    原文:乐在其中设计模式(C#) - 代理模式(Proxy Pattern) [索引页][源码下载] 乐在其中设计模式(C#) - 代理模式(Proxy Pattern) 作者:webabcd 介绍 为 ...