// // UIView+Extension.h // JWlive // // Created by pican zhang on 16/3/17. // Copyright © 2016年 pican zhang. All rights reserved. // #import @interface UIView (Extension) //获取UIView的frame @property (nonatomic, assign) CGFloat x; @property (nonatomic, assign) CGFloat y; @property (nonatomic, assign) CGFloat centerX; @property (nonatomic, assign) CGFloat centerY; @property (nonatomic, assign) CGFloat width; @property (nonatomic, assign) CGFloat height; @property (nonatomic, assign) CGSize size; @property (assign, nonatomic) CGPoint origin; //给UIView画灰色的线 - (void)HorizonLinePaddingToTop:(CGFloat)top; - (void)VerticalLinePaddingToLeft:(CGFloat)left; - (void)RightLinePaddingTop:(CGFloat)top; - (void)LeftLinePaddingTop:(CGFloat)top; //绘制顶部的线 - (void)topLinepaddingLeft:(CGFloat)left; - (void)topLineforView; - (void)topLineforViewWithColor:(UIColor*)color; //绘制底部的线 - (void)bottomLineforViewHeight:(CGFloat)height; - (void)bottomLineforView; - (void)bottomLineforViewWithColor:(UIColor*)color; - (void)bottomWideLineforView:(CGFloat)height; - (void)addLineWithColor:(UIColor *)color lineRect:(CGRect)rect; //找到自己的vc - (UIViewController *)viewController; /** 将像素point由point所在视图转换到目标view或window中,返回在目标view或window中的像素值 @param point 在视图的局部坐标(bounds)中指定的像素点。 @param view 要转换为其坐标点的view或window。如果view为nil,此方法将转换为window基坐标。 @return 像素点转换为view或window的坐标。 */ - (CGPoint)convertPoint:(CGPoint)point toViewOrWindow:(nullable UIView *)view; /** 将像素point从view或window中转换到当前视图中,返回在当前视图中的像素值 @param point 在视图的局部坐标(bounds)中指定的像素点。 @param view 要转换为其坐标点的view或window。如果view为nil,此方法将转换为window基坐标。 @return 像素点转换为view或window的坐标。 */ - (CGPoint)convertPoint:(CGPoint)point fromViewOrWindow:(nullable UIView *)view; /** 将rect由rect所在视图转换到目标视图view中,返回在目标视图view或window中的rect @param rect 需要转换视图的rect @param view 要转换为其坐标点的view或window。如果view为nil,此方法将转换为window基坐标。 @return 转换后的rect */ - (CGRect)convertRect:(CGRect)rect toViewOrWindow:(nullable UIView *)view; /** 将rect从view或window中转换到当前视图中,返回在当前视图中的rect @param rect 需要转换视图的rect @param view 要转换为其坐标点的view或window。如果view为nil,此方法将转换为window基坐标。 @return 转换后的rect */ - (CGRect)convertRect:(CGRect)rect fromViewOrWindow:(nullable UIView *)view; @end