Key Contents of the lol box and contents of the lol box

Source: Internet
Author: User

Key Contents of the lol box and contents of the lol box
// AFN function-imageview: load the network image and obtain the image. After obtaining the image, store it on the mobile phone.[Image setImageWithURLRequest: [NSURLRequestrequestWithURL: [NSURLURLWithString: [NSStringstringWithFormat: @ "% @", skin. bigImg] placeholderImage: nilsuccess: ^ (NSURLRequest * request, NSHTTPURLResponse * response, UIImage * image) {signature (image, self, @ selector (image: Signature: contextInfo :), nil);-(void) image :( UIImage *) image didFinishSavingWithError :( NSError *) error contextInfo :( void *) contextInfo
{
If (error ){
[SelfshowToastWithText: @ "Save not allowed"];
} Else {
[SelfshowToastWithText: @ "saved successfully"];
}}
_ Player = [[AVAudioPlayer alloc] initWithContentsOfURL: [NSURL fileURLWithPath: file] error: nil];
// NSLog (@ "% @", [NSURL fileURLWithPath: file]);
// [_ Player play];
// Audioplayer third-party class library playback File
AudioPlayer * player = [AudioPlayersharePlayer]; [player playWithDataSourceType: DataSourceTypeLocalwithURLString: file];
// Download an object
NSString * string = [NSStringstringWithFormat: HERO_SOUND_DESC_URL, pathName, fileName];
NSURL * url = [NSURLURLWithString: [stringstringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
NSURLRequest * request = [NSURLRequestrequestWithURL: url];

AFHTTPRequestOperation * operation = [[AFHTTPRequestOperationalloc] initWithRequest: request];
Operation. inputStream = [NSInputStreaminputStreamWithURL: url];
Operation. outputStream = [NSOutputStreamoutputStreamToFileAtPath: fileappend: NO];
[Operation setCompletionBlockWithSuccess: ^ (AFHTTPRequestOperation * operation, id responseObject ){
NSLog (@ "Download successful ");
[_ TableviewreloadData];
} Failure: ^ (AFHTTPRequestOperation * operation, NSError * error ){
NSLog (@ "Download failed ");
}]; [Operation start];// Scale the scrollview to one time when the slide is stopped-(Void) scrollViewDidEndDecelerating :( UIScrollView *) scrollView
{_ PageIndex = scrollView. contentOffset. x/SCREEN_WIDTH;
For (UIScrollView * scrollview in scrollView. subviews)
{
If ([scrollview isKindOfClass: [UIScrollViewclass]) {[scrollview setZoomScale: 1.0];}
}
HeroSkin * skin = [_ heroskinobjectAtIndex: _ pageIndex];
_ Namelabel. text = skin. name;
_ Pricelabel. text = skin. price;
_ Pagelabel. text = [NSStringstringWithFormat: @ "% ld of % lu", _ pageIndex + 1, (unsignedlong) _ heroskin. count];
NSLog (@ "% ld", (long) _ pageIndex );}
// Shake the image
-(Void) ImageShake
{
CABasicAnimation * basic = [CABasicAnimationanimationWithKeyPath: @ "transform. rotation. z"];
Basic. fromValue = [NSNumbernumberWithFloat:-M_PI/16];
Basic. toValue = [NSNumbernumberWithFloat: M_PI/16];
Basic. duration= 0.1;
Basic. repeatCount = 3; [imageview. layeraddAnimation: basic forKey: @ "animateLayer"]; // AudioServicesPlaySystemSound (kSystemSoundID_Vibrate );}
// Detect motion
-(Void) motionEnded :( UIEventSubtype) motion withEvent :( UIEvent *) event
{
If (motion = UIEventSubtypeMotionShake ){
[SelfImageShake];
[Playerplay];
}}
// Calculate the frame size of a string
-(CGSize) getStringRect :( NSString *) str
{
If (str. length <1 ){
ReturnCGSizeMake (0, 0 );
}
CGSize size;
NSAttributedString * string = [[NSAttributedStringalloc] initWithString: str];
// NSDictionary * attribute =@{ NSFontAttributeName: @ 12 };
Size = [string boundingRectWithSize: CGSizeMake (280,500) options: NSStringDrawingTruncatesLastVisibleLine |
NSStringDrawingUsesLineFragmentOrigin |
NSStringDrawingUsesFontLeadingcontext: nil]. size;
Return size ;}
-(CGFloat) caculateLabelHeightWith :( float) fontsize String :( NSString *) str
{
UIFont * font = [UIFontsystemFontOfSize: fontsize];
CGSize size = CGSizeMake (300,700 );
CGSize descriptionSize = [str sizeWithFont: font constrainedToSize: size lineBreakMode: NSLineBreakByWordWrapping];
Return descriptionSize. height ;}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.