zoukankan      html  css  js  c++  java
  • 开发小技巧总结

    1、滑动的时候隐藏navigation  bar

    navigationController.hidesBarsOnSwipe = Yes;
    

     2、消除导航条返回键自带的title

    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -60)
                                                     forBarMetrics:UIBarMetricsDefault];
    

     3、将导航条变得透明而不模糊

    [self.navigationController.navigationBar setBackgroundImage:[UIImage new]
                             forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar .shadowImage = [UIImage new];
    self.navigationController.navigationBar .translucent = YES;
    

     4、拉伸图片不变形

    [[UIImage imageNamed:@""] stretchableImageWithLeftCapWidth:10 topCapHeight:10];
    [[UIImage imageNamed:@""] resizableImageWithCapInsets:UIEdgeInsetsMake(10, 10, 10, 10)];
    

     5、gif图片显示优化

    FLAnimatedImage可以帮你完成GIF的显示处理。解决GIF显示卡顿的情况。

    FLAnimatedImage *image = [FLAnimatedImage animatedImageWithGIFData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://upload.wikimedia.org/wikipedia/commons/2/2c/Rotating_earth_%28large%29.gif"]]];
    FLAnimatedImageView *imageView = [[FLAnimatedImageView alloc] init];
    imageView.animatedImage = image;
    imageView.frame = CGRectMake(0.0, 0.0, 100.0, 100.0);
    [self.view addSubview:imageView];
    

     6、CollectionView实现tableview的悬停header

    CSStickyHeaderFlowLayout可以解决您的疑问。

    #import "CSStickyHeaderFlowLayout.h"
    - (void)viewDidLoad {
     [super viewDidLoad]; // Locate your layout     
    CSStickyHeaderFlowLayout *layout = (id)self.collectionViewLayout;
    if ([layout isKindOfClass:[CSStickyHeaderFlowLayout class]]) { 
    layout.parallaxHeaderReferenceSize = CGSizeMake(320, 200);
     } 
    }
    
    
    - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { // Check the kind if it's CSStickyHeaderParallaxHeader 
    if ([kind isEqualToString:CSStickyHeaderParallaxHeader]) { 
    UICollectionReusableView *cell = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"header" forIndexPath:indexPath];
     return cell; 
    } 
    }
    
  • 相关阅读:
    Java之List使用方法
    Java之数组遍历
    收集关于前端的一些网站、博客资源、框架、源码等 、 会持续更新哦!!!!!
    css常用代码含义
    css两列等高布局
    HTML之DocType的几种类型
    CSS实现圆角的方法
    IE6图片元素img下出现多余空白问题
    web标准常见问题整理
    好的 Web 前端年薪会有多少?
  • 原文地址:https://www.cnblogs.com/angongIT/p/5707275.html
Copyright © 2011-2022 走看看