Saturday, June 14, 2014

Adding Shadow Effect:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIView *redView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    redView.layer.cornerRadius = 10;
    redView.layer.shadowColor = [[UIColor blackColor] CGColor];
    redView.layer.shadowOpacity = 1;
    redView.layer.shadowRadius = 10;
    redView.layer.shadowOffset = CGSizeMake(-2, 7);
    [redView setBackgroundColor:[UIColor redColor]];
    redView.center=  CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 2);
    [self.view addSubview:redView];  
}

No comments: