UIView(DTFoundation) Category Reference
Getting Snapshot Images
Adds a layer-based shadow to the receiver.
- (void)addShadowWithColor:(UIColor *)color alpha:(CGFloat)alpha radius:(CGFloat)radius offset:(CGSize)offset
The shadow color. Can be
nilfor default black.
The alpha value of the shadow.
The amount that the shadow is blurred.
The offset of the shadow
The advantage of using this method is that you do not need to import the QuartzCore headers just for adding the shadow. Layer-based shadows are properly combined for views that are on the same superview. This does not add a shadow path, you should call updateShadowPathToBounds whenever the receiver’s bounds change and also after setting the initial frame. @warn Disables clipping to bounds because this would also clip off the shadow.
Sets the corner attributes of the receiver’s layer.
- (void)setRoundedCornersWithRadius:(CGFloat)radius width:(CGFloat)width color:(UIColor *)color
The corner radius.
The width of the border line.
The color to be used for the border line. Can be
nilto leave it unchanged.
The advantage of using this method is that you do not need to import the QuartzCore headers just for setting the corners.
Creates a snapshot of the receiver.
- (UIImage *)snapshotImage
Returns a bitmap image with the same contents and dimensions as the receiver.
sets the shadow path to fit the receiver’s bounds.
- (void)updateShadowPathToBounds:(CGRect)bounds withDuration:(NSTimeInterval)duration
The new bounds of the shadow path
The animation duration. Specify a duration of 0 to not do an animation
This should be called whenever the receiver’s bounds change, or else the shadow detaches.
@warn Since this a CALayer property it needs to be explicitly animated, for example in the willRotate … method of a