0

I'm looking out for some solution regarding the custom progress view.

Basically, i would like to fill the image below to represent the loading progress,just like the one's we have in games.

enter image description here

Any ideas how to achieve it??

Shrey
  • 1,959
  • 2
  • 21
  • 44
  • Mask it anyway you like - with non-transparent UIView or use CGMaskRef - and tie mask height to loading progress. Simple as that. – Kyr Dunenkoff Feb 04 '12 at 10:10
  • Thanks for your quick reply. Can u please guide me to the masking functionality? m noob in CG. – Shrey Feb 04 '12 at 10:14

2 Answers2

0

Masking using CoreGraphics:

UIImage *img = [UIImage imageNamed:@"imagetomask.png"];
CGImageRef maskRef = [UIImage imageNamed:@"mask.png"].CGImage;
CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
                                                CGImageGetHeight(maskRef),
                                                CGImageGetBitsPerComponent(maskRef),
                                                CGImageGetBitsPerPixel(maskRef),
                                                CGImageGetBytesPerRow(maskRef),
                                                CGImageGetDataProvider(maskRef), NULL, false);

CGImageRef maskedImage = CGImageCreateWithMask([img CGImage], mask);
[imageView setImage:maskedImage];

Your mask.png should be non-transparent image filled like inverted alpha - black for visible parts, white for transparent.

Kyr Dunenkoff
  • 8,090
  • 3
  • 23
  • 21
0

Create custom view class and add animation sequence in that class to show your images in sequence infinitly.

Add that view to mainwindow like this (UIWindow*)[[UIApplication sharedApplication].windows objectAtIndex:0];

call bringSubviewToFront to show that view on any view where u want this loading screen(view).

Shefali Soni
  • 1,234
  • 14
  • 26