pod 'PYBaseView'

The Denver nuggets

Demo

Encapsulates a lot of more commonly used controls:

  1. BaseGradientView: Gradient view
  2. PYTableMainView: encapsulates a tableView (ZHTableViewGroup is recommended for other tableView tools)
  3. PYBaseView: Rounded corner view
  4. BasePointProgressView: the progress bar
  5. PYBaseSize: Management of some common widths and heights

BaseGradientView Gradient view

  • Object oriented color gradient tool

    • The PYGradientViewLineConfig PYGradientView object calls the method drawLineGradient to set the linear config and immediately draw the gradient

      [self.gradientView drawLineGradient:^(PYGradientViewLineConfig *lineConfig) {
                  lineConfig
                  .setUpScaleEndCenter(CGPointMake(0, 0))
                  .setUpScaleStartCenter(CGPointMake(1, 1))
                  .setUpColorArray(@[
                                     UIColor.redColor,
                                     UIColor.cyanColor
                                     ])
                  .setUpLocationArray(@[
                                        @0,@1
                                        ]);
          
      }];
      Copy the code
    • Diffusion gradient PYGradientViewDrawRadialConfig PYGradientView object method is called drawRadialGradient linear config Settings, and draws a color gradient immediately

      [self.gradientView drawRadialGradient:^(PYGradientViewDrawRadialConfig *radialConfig) { radialConfig SetUpScaleEndCenter (CGPointMake (0.5, 0.5)). SetUpScaleStartCenter (CGPointMake (0.5, 0.5)). SetUpColorArray (@ [UIColor redColor, SetUpStartRadius (0).setupendRADIUS (1000).setuplocationArray (@[@0.1,@1]);}];Copy the code

PYTableMainView

  1. High aggregation code.

  2. Discard group restrictions and use type or key to distinguish between cell, header, and footer

  3. Lazy loading automatically caches the frame of each cell, header, and footer

  4. Dynamically register headers, cells, and footers

  5. ZHTableViewGroup

PYBaseView Rounded corner view

- (PYBaseView *)roundView { if (! _roundView) { _roundView = [PYBaseView new]; _roundView. Config. SetUpLeftTopAddRadius (6) / / additional radius. The top left hand corner setUpLeftBottomAddRadius (20)/increase/left corner radius SetUpRightTopAddRadius (35) additional radius. / / right corner setUpRightBottomAddRadius (50) / / additional radius at the bottom right. SetUpShadowAlpha alpha (1) / / shadow .setupShadowColor (uicolor.redcolor).setupShadowRadius (10).setupShadowOffset (CGSizeMake(10, 10))/ .setUpRightBottomAddRadius(50) .setUpShadowAlpha(1) .setUpShadowColor(UIColor.redColor) .setUpShadowRadius(10) .setUpShadowOffset(CGSizeMake(10, 10)); _roundView.isDrawShadow = true; } return _roundView; }Copy the code

BasePointProgressView progress bar

PYBaseSize manages some common widths and heights

Some commonly used heights and widths are provided.

@interface PYBaseSize : @property(class, nonatomic, readOnly) CGFloat navTotalH; @property(class, nonatomic, readonly) CGFloat navBarH; @property(class, nonatomic, readonly) CGFloat statusBarH; @property(class, nonatomic, readonly) CGFloat homeBarH; @property(class, nonatomic, readonly) CGFloat tabbarH; @property(class, nonatomic, readonly) CGFloat screenW; @Property (class, nonatomic, readonly) CGFloat screenH; Screenh-navTotalh@property (class, nonatomic, readonly) CGFloat screen_navH; @property(class, nonatomic, readonly) CGFloat screen_nav_tabBarH; + (void) setNavTotalH: (CGFloat) h; + (void) setNavBarH: (CGFloat) h; + (void) setStatusBarH: (CGFloat) h; + (void) setHomeBarH: (CGFloat) h; @endCopy the code
#import "PYBaseSize.h" @implementation PYBaseSize static CGFloat navTotalH = 0; static CGFloat navBarH = 0; static CGFloat statusBarH = 0; static CGFloat homeBarH = 0; static CGFloat tabbarH = 0; static CGFloat screenW = 0; static CGFloat screenH = 0; static CGFloat screen_navH = 0; static CGFloat screen_nav_tabBarH = 0; + (CGFloat)navBarH { if (navBarH <= 0) { UINavigationController *baseNavc = [[UINavigationController alloc]init]; navBarH = baseNavc.navigationBar.bounds.size.height; } return navBarH; } + (CGFloat) navTotalH { if (navTotalH <= 0) { navTotalH = PYBaseSize.navBarH + PYBaseSize.statusBarH; } return navTotalH; } + (CGFloat)homeBarH { if (homeBarH <= 0) { homeBarH = PYBaseSize.statusBarH>20? 34:0; } return homeBarH; } + (CGFloat) tabbarH { if (tabbarH <= 0) { tabbarH = [[UIApplication sharedApplication] statusBarFrame].size.height>20? 83:49; } return tabbarH; } + (CGFloat) screenW { if (screenW <= 0) { screenW = [UIScreen mainScreen].bounds.size.width; } return screenW; } + (CGFloat) screenH { if (screenH <= 0) { screenH = [UIScreen mainScreen].bounds.size.height; } return screenH; } + (CGFloat)screen_navH { if (screen_navH <= 0) { screen_navH = PYBaseSize.screenH - PYBaseSize.navTotalH; } return screen_navH; } + (CGFloat)screen_nav_tabBarH { if (screen_nav_tabBarH <= 0) { screen_nav_tabBarH = PYBaseSize.screen_navH - PYBaseSize.tabbarH; } return screen_nav_tabBarH; } + (CGFloat)statusBarH { if (statusBarH <= 0) { statusBarH = [[UIApplication sharedApplication] statusBarFrame].size.height; } return statusBarH; } + (void) setNavBarH: (CGFloat) h { navBarH = h; } + (void) setNavTotalH: (CGFloat) h { navTotalH = h; } + (void) setStatusBarH: (CGFloat) h { statusBarH = h; } + (void) setHomeBarH: (CGFloat) h { homeBarH = h; } @endCopy the code