Graphics Reference
In-Depth Information
FIGURE 10-5
Image Reflection with Gradient Layer
LISTING 10-5
Applying Reflection Using a Gradient Layer
- ( void )viewDidLoad
{
[ super viewDidLoad ];
[[[ self view ] layer ] setBackgroundColor :
[[ UIColor blackColor ] CGColor ]];
UIImage *balloon = [ UIImage imageNamed : @”balloon.jpg” ];
// Create the top layer; this is the main image
CALayer *topLayer = [[ CALayer alloc ] init ];
[topLayer setBounds : CGRectMake (0.0f, 0.0f, 320.0, 240.0)];
[topLayer setPosition : CGPointMake (160.0f, 120.0f)];
[topLayer setContents :( id )[balloon CGImage]];
// Add the layer to the view
[[[ self view ] layer ] addSublayer :topLayer];
Search WWH ::




Custom Search