text: //
  //  UIView+frame.h
  //  JJBadgeDemo
  //
  //  Created by Jiangwen Tang on 16/7/11.
  //  Copyright © 2016年 Jiangwen Tang. All rights reserved.
  //
  
  #import <UIKit/UIKit.h>
  
  @interface UIView (JJPosition)
  
  @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.
  
  @property (nonatomic, readonly) CGRect screenFrame; ///< View frame on the screen, taking into account scroll views.
  
  /**
   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;
  @end
  