Create UIImage and UIImageView

Takefumi Katsuren 7th of March 2012

- (UIImage*)createImage:(NSString*)inFileName
{
  NSString *pathForResource = [inFileName stringByDeletingPathExtention];
  NSString *extension = [inFileName pathExtension];
  NSString *filePath = [[NSBundle mainBundle] pathForResource:pathForResource ofType:extension];
  UIImage *image = [[UIImage alloc] initWithContentsOfFile:filePath];
  return image;
}

- (UIImageView*)createImageView:(NSString*)inFileName
{
  UIImage *image = [self createImage:inFileName];
  UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
  [imageView setBounds:CGRectMake(0, 0, image.size.width, image.size.height)];
  [image release];
  image = nil;
  return imageView;
}
306
Views
0
Comments
0
Downloads
Comments
Only Code Pad members can post comments!

Want to join Code Pad Request An Invite
    No Comments Posted

Suppo - Create, Customize & Host
Your App Support Page at Suppo

Snippet Details

Keyboard Shortcuts

DDownload

TTweet

FFull View

Next Snippet

Previous Snippet