Several tips in iOS development

Source: Internet
Author: User

 

IOS game programming starts from scratch-cocos2dx and cocos2d engine development. The knowledge inside is simplified into depth, giving a detailed and in-depth explanation to the developers of basic IOS. I will share some tips on iOS development with you.

1. compressed image: uiimage * yourimage = [self imagewithimagesimple: Image scaledtosize: cgsizemake (210.0,
(210.0)];

- (UIImage*)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize  {      // Create a graphics image context      UIGraphicsBeginImageContext(newSize);            // Tell the old image to draw in this newcontext, with the desired      // new size      [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];            // Get the new image from the context      UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();            // End the context      UIGraphicsEndImageContext();            // Return the new image.      return newImage;  }  

2. url Encoding

NSString * encodedString = (NSString *)CFURLCreateStringByAddingPercentEscapes  (NULL, (CFStringRef)yourtext, NULL,   (CFStringRef)@”!*’();:@&=+$,/?%#[]“, kCFStringEncodingUTF8);

3. Set navigationbar to hide

self.navigationController.navigationBarHidden = YES;

4. load images in imageview

UIImage *myImage = [UIImage imageNamed:@"1.jpg"];  [imageView setImage:myImage];  [self.view addSubview:imageView]; 

5. How to stop the uiview Animation

#import<QuartzCore/QuartzCore.h>[self.view.layer removeAllAnimations];

6. Use tags to retrieve controls on cells

[cell.contentView viewWithTag:tag];
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.