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];