Initial commit
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// UIView+YYAdd.h
|
||||
// YYKit <https://github.com/ibireme/YYKit>
|
||||
//
|
||||
// Created by ibireme on 13/4/3.
|
||||
// Copyright (c) 2015 ibireme.
|
||||
//
|
||||
// This source code is licensed under the MIT-style license found in the
|
||||
// LICENSE file in the root directory of this source tree.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
/**
|
||||
Provides extensions for `UIView`.
|
||||
*/
|
||||
@interface UIView (UMComAddition)
|
||||
|
||||
/**
|
||||
Create a snapshot image of the complete view hierarchy.
|
||||
*/
|
||||
- (UIImage *)snapshotImage_;
|
||||
|
||||
/**
|
||||
Create a snapshot image of the complete view hierarchy.
|
||||
@discussion It's faster than "snapshotImage", but may cause screen updates.
|
||||
See -[UIView drawViewHierarchyInRect:afterScreenUpdates:] for more information.
|
||||
*/
|
||||
- (UIImage *)snapshotImageAfterScreenUpdates_:(BOOL)afterUpdates;
|
||||
|
||||
/**
|
||||
Create a snapshot PDF of the complete view hierarchy.
|
||||
*/
|
||||
- (NSData *)snapshotPDF_;
|
||||
|
||||
/**
|
||||
Shortcut to set the view.layer's shadow
|
||||
|
||||
@param color Shadow Color
|
||||
@param offset Shadow offset
|
||||
@param radius Shadow radius
|
||||
*/
|
||||
- (void)setLayerShadow_:(UIColor*)color offset:(CGSize)offset radius:(CGFloat)radius;
|
||||
|
||||
/**
|
||||
Remove all subviews.
|
||||
|
||||
@warning Never call this method inside your view's drawRect: method.
|
||||
*/
|
||||
- (void)removeAllSubviews_;
|
||||
|
||||
/**
|
||||
Returns the view's view controller (may be nil).
|
||||
*/
|
||||
@property (nonatomic, readonly) UIViewController *viewController_;
|
||||
|
||||
/**
|
||||
Returns the visible alpha on screen, taking into account superview and window.
|
||||
*/
|
||||
@property (nonatomic, readonly) CGFloat visibleAlpha_;
|
||||
|
||||
/**
|
||||
Converts a point from the receiver's coordinate system to that of the specified view or window.
|
||||
|
||||
@param point A point specified in the local coordinate system (bounds) of the receiver.
|
||||
@param view The view or window into whose coordinate system point is to be converted.
|
||||
If view is nil, this method instead converts to window base coordinates.
|
||||
@return The point converted to the coordinate system of view.
|
||||
*/
|
||||
- (CGPoint)convertPoint_:(CGPoint)point toViewOrWindow:(UIView *)view;
|
||||
|
||||
/**
|
||||
Converts a point from the coordinate system of a given view or window to that of the receiver.
|
||||
|
||||
@param point A point specified in the local coordinate system (bounds) of view.
|
||||
@param view The view or window with point in its coordinate system.
|
||||
If view is nil, this method instead converts from window base coordinates.
|
||||
@return The point converted to the local coordinate system (bounds) of the receiver.
|
||||
*/
|
||||
- (CGPoint)convertPoint_:(CGPoint)point fromViewOrWindow:(UIView *)view;
|
||||
|
||||
/**
|
||||
Converts a rectangle from the receiver's coordinate system to that of another view or window.
|
||||
|
||||
@param rect A rectangle specified in the local coordinate system (bounds) of the receiver.
|
||||
@param view The view or window that is the target of the conversion operation. If view is nil, this method instead converts to window base coordinates.
|
||||
@return The converted rectangle.
|
||||
*/
|
||||
- (CGRect)convertRect_:(CGRect)rect toViewOrWindow:(UIView *)view;
|
||||
|
||||
/**
|
||||
Converts a rectangle from the coordinate system of another view or window to that of the receiver.
|
||||
|
||||
@param rect A rectangle specified in the local coordinate system (bounds) of view.
|
||||
@param view The view or window with rect in its coordinate system.
|
||||
If view is nil, this method instead converts from window base coordinates.
|
||||
@return The converted rectangle.
|
||||
*/
|
||||
- (CGRect)convertRect_:(CGRect)rect fromViewOrWindow:(UIView *)view;
|
||||
|
||||
|
||||
@property (nonatomic) CGFloat left_; ///< Shortcut for frame.origin.x.
|
||||
@property (nonatomic) CGFloat top_; ///< Shortcut for frame.origin.y
|
||||
@property (nonatomic) CGFloat right_; ///< Shortcut for frame.origin.x + frame.size.width
|
||||
@property (nonatomic) CGFloat bottom_; ///< Shortcut for frame.origin.y + frame.size.height
|
||||
@property (nonatomic) CGFloat width_; ///< Shortcut for frame.size.width.
|
||||
@property (nonatomic) CGFloat height_; ///< Shortcut for frame.size.height.
|
||||
@property (nonatomic) CGFloat centerX_; ///< Shortcut for center.x
|
||||
@property (nonatomic) CGFloat centerY_; ///< Shortcut for center.y
|
||||
@property (nonatomic) CGPoint origin_; ///< Shortcut for frame.origin.
|
||||
@property (nonatomic) CGSize size_; ///< Shortcut for frame.size.
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user