Showing posts with label CALayer related.... Show all posts
Showing posts with label CALayer related.... Show all posts

29 Sept 2017

How to give different (Mixing of = Gradient colours)colours to View...



How to give different  (Mixing of = Gradient colours)colours to View...




@property (weak, nonatomic) IBOutlet UIView *navBgView;



  CAGradientLayer *gradientMask = [CAGradientLayer layer];
    gradientMask.frame = CGRectMake(0, 0, self.view.frame.size.width, 150);
    
    gradientMask.startPoint = CGPointMake(0.0, 0.5);   // start at left middle
    gradientMask.endPoint = CGPointMake(1.0, 0.5);     // end at right middle
    
    gradientMask.colors = @[(id)[UIColor colorWithRed:91/255.0 green:232/255.0 blue:200/255.0 alpha:0.7].CGColor,
                            (id)[UIColor colorWithRed:91/255.0 green:232/255.0 blue:200/255.0 alpha:0.7].CGColor,
                            (id)[UIColor colorWithRed:91/255.0 green:232/255.0 blue:200/255.0 alpha:0.5].CGColor,
                            (id)[UIColor colorWithRed:85/255.0 green:188/255.0 blue:222/255.0 alpha:0.5].CGColor,
                            (id)[UIColor colorWithRed:85/255.0 green:188/255.0 blue:222/255.0 alpha:0.7].CGColor,
                            (id)[UIColor colorWithRed:85/255.0 green:188/255.0 blue:222/255.0 alpha:0.7].CGColor];
    
    gradientMask.locations = @[@0.0, @0.10, @0.40, @0.80, @0.90, @1.0];
    [_navBgView.layer insertSublayer:gradientMask atIndex:0];

How to give a border to View or Cell like shown...


How to give a border to View or Cell like shown...



    cell.layer.cornerRadius = 8.0;
    cell.layer.shadowOffset = CGSizeMake(-1, -1);
    cell.layer.shadowRadius = 3.0;
    cell.layer.shadowOpacity = 0.2;
    cell.layer.masksToBounds = NO;
    [cell.layer setShadowColor: [UIColor blackColor].CGColor];

How to add Borderline to View...



How to add Borderline to View...


@property (weak, nonatomic) IBOutlet UIView *topView;



    // Add a bottomBorder.
    CALayer *bottomBorder = [CALayer layer];
    
    bottomBorder.frame = CGRectMake(0.0f, 39.0f, self.view.frame.size.width, 0.8f);
    bottomBorder.backgroundColor = [[UIColor lightGrayColor] colorWithAlphaComponent:0.2].CGColor;
    [_topView.layer addSublayer:bottomBorder];

Recent Posts

Codable demo

Link: https://www.dropbox.com/s/kw7c1kgv1628bh7/codableDemo.zip?dl=0