Bofore adding the Code import QuartzCore (#import <QuartzCore/QuartzCore.h>)
UIImage *MyImage=[UIImage imageNamed: @"baby.jpg"];
MyImage.layer.borderColor = [UIColor lightGrayColor].CGColor;
MyImage.layer.borderWidth = 2.0;
To add Corner radius for the same image just add below two linesMyImage.layer.cornerRadius = 10.0;
MyImage.layer.masksToBounds = YES;
UIImage does not have a layer property. You might want to update your example to UIImageView instead as that is probably what you meant to use...
ReplyDelete