//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. 【NOIP2002】矩形覆盖 DFS

    首先,我喜欢愤怒搜索,因为尽管说K<=4,的确K小于或等于3的. 当然某些K<=3还600ms的我就不加评论了. 好吧,可是怎么搜呢?我们考虑到矩形数量非常少,所以能够怒搜矩形. 一些神做 ...

  2. MVC json

    1. .net MVC中Controller 在mvc中所有的controller类都必须使用"Controller"后缀来命名 并且对Action也有一定的要求: 必须是一个pu ...

  3. Shell 遍历字符串与参数

    遍历字符串: for line in  $Table_List do         echo $Table_List         echo $Table_List >> ${SYB_ ...

  4. 利用Pattern和Mather来禁止特殊字符的输入

    String regEx="[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}[]‘::”“’.,.?]&q ...

  5. ps命令用法详解(转)

    ps p 22763  -L -o pcpu,pid,tid,time,tname,cmd,pmem,rss --sort rss  按rss排序 ps p 26653 -L -o pcpu,tid ...

  6. [LeetCode145]Binary Tree Postorder Traversal

    题目: Given a list, rotate the list to the right by k places, where k is non-negative. For example:Giv ...

  7. [LeetCode299]Bulls and Cows

    题目: You are playing the following Bulls and Cows game with your friend: You write down a number and ...

  8. Git显示漂亮日志的小技巧

    Git的传统log如下所示,你喜欢吗? 看看下面这个你喜不喜欢?(点击图片看大图) 要做到这样,命令行如下: 1 git log --graph --pretty=format:'%Cred%h%Cr ...

  9. FireFox VS Chrome 之 调试篇

    一个完美的调试工具,FireBug! 精确跟踪每一步.仅仅要按下图所看到的,选择"脚本",然后在下方选择脚本所在的文件就可以对该文本的运行进行断点跟踪. 而且仅当一个线程运行结束后 ...

  10. python基础课程_学习笔记26:编程的乐趣

    编程的乐趣 编程柔术 当你坐下来,打算如何组织计划要定时,具体程序,然而,无论什么经验.在实现时间的函数的,你会逐渐学会了原来的设计,实用的新知识.我们不应该忽视沿途汲取的教训,相反,它们用于其他设计 ...