//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. How to import the www.googleapis.com SSL CA certification to the jks store file?

    Assumed that you have installed JDK and configured JAVA_HOME for your current operation system. (1)  ...

  2. mysql寻呼最快

    大家都知道,mysql分页写: select * from 'yourtable' limit start,rows 如今我数据库一张表里面有9969W条数据.表名叫tweet_data select ...

  3. 深入了解mysql它BDB系列(1)---BDB基础知识

        深入了解mysql它BDB系列(1) ---BDB关基础知识 作者:杨万富   一:BDB体系结构 1.1.BDB体系结构 BDB总体的体系结构如图1.1所看到的.包括五个子系统(见图1.1中 ...

  4. Ibatis之3个不经常使用的Query方法

    1.queryForObject /** * Executes a mapped SQL SELECT statement that returns data to populate * the su ...

  5. 玩转Web值jquery(一)---对表单中的某一标签批量处理(以input为例)

    jquery可以对form进行操作,以批量操作某一标签,这里以input标签为例总结. 示例一:对删除infoForm表单的input的所有readonly属性 $("#infoForm i ...

  6. twrp 2.7.0 ui.xml简单分析,布局讲解,第一章

    twrp 的ui.xml文件在bootable/recovery/gui/devices/$(DEVICE_RESOLUTION)/res目录里面 下面我主要分析的是720x1280分辨率的界面布局及 ...

  7. JSP+Ajax站点开发小知识

    一.JSP基础 1.<select  name="love"  size="3">当中的size属性指定了列表框显示选项的条数.假设全部选项多于这个 ...

  8. Java 的swing.GroupLayout布局管理器的使用方法和实例(转)

    The following builds a panel consisting of two labels in one column, followed by two textfields in t ...

  9. 说说nio2

    利不百不变法,功不十不易器 为什么会出现nio,之前的io有什么问题? 请先看 说说nio1 nio类图例如以下 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZX ...

  10. 5月,专用程序猿的经典大作——APUE

    五一小长假刚刚过去,收回我们游走的心.開始你们的读书旅程吧! 本期特别推荐 经典UNIX著作最新版. 20多年来,这本书帮助几代程序猿写出强大.高性能.可靠的代码. 第3版依据当今主流系统进行更新,更 ...