 <p>I use the second one with slight modification,</p> <pre><code>UIImageView *shadowView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 150, 800, 600)]; shadowView.image = [UIImage imageWithData:[NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fileName ofType:extension] ]; </code></pre> <p>because imageNamed: caches image and cause memory leak.</p>