zoukankan      html  css  js  c++  java
  • iOS开发技巧

    1.TableView隐藏没有内容的cell

    self.tableView.tableFooterView = [[UIView alloc] init];

    2.自定义了leftBarbuttonItem左滑返回手势失效

    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]
                                             initWithImage:img
                                             style:UIBarButtonItemStylePlain
                                             target:self
                                             action:@selector(onBack:)];
    self.navigationController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;

    3.ScrollView莫名其妙不能在viewController划到顶

    self.automaticallyAdjustsScrollViewInsets = NO;

    4.app老是不流畅

    这个神器叫做:KMCGeigerCounter

    5.在不新建一个Cell的情况下调整separaLine的位置

    _myTableView.separatorInset = UIEdgeInsetsMake(0, 100, 0, 0);

    6.点击self.view就让键盘收起

    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    {
       [self.view endEditing:YES];
    }

    7.在代码里改在xib里添加的layoutAttribute

    像拉button一样的拉你的约束.nslayoutattribute也是可以拉线的.

    8.像safari一样滑动的时候隐藏navigationbar

    navigationController.hidesBarsOnSwipe = Yes

    9.导航条返回键带的title消失

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

    10.CollectionView 实现tableview那种悬停的header

    CSStickyHeaderFlowLayout

    11.拉伸图片的时候让图片不变形

    UIImage *image = [[UIImage imageNamed:@"xxx"] stretchableImageWithLeftCapWidth:10 topCapHeight:10];
    (现在的方法叫resizableImageWithCapInsets).

    12.播放GIF的时候卡

    FlipBoard出品的太适合你了。https://github.com/Flipboard/FLAnimatedImage

    13.把tableview里cell的小对勾的颜色改成别的颜色

    _mTableView.tintColor = [UIColor redColor];

    14.本来我的statusbar是lightcontent的,结果用UIImagePickerController会导致我的statusbar的样式变成黑色

    - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
    {
        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
    }

    15.把navigationbar弄成透明的而不是带模糊的效果

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

    16改变uitextfield placeholder的颜色和位置

    //继承uitextfield,重写这个方法
    - (void) drawPlaceholderInRect:(CGRect)rect {
        [[UIColor blueColor] setFill];
        [self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];
    }
  • 相关阅读:
    Oracle 网络
    Oracle 实例管理
    Oracle 体系结构四 逻辑和物理存储结构之间的关系
    Oracle 体系结构三 后台进程
    Oracle 体系结构二 内存结构
    Oracle 体系结构一 概述
    SQL 二
    SQL 一
    如何获取SQL Server数据库元数据的方法
    VB.NET中使用代表对方法异步调用
  • 原文地址:https://www.cnblogs.com/WJJ-Dream/p/5821180.html
Copyright © 2011-2022 走看看