美文网首页
10个开发小技巧

10个开发小技巧

作者: 小王在努力 | 来源:发表于2018-06-29 16:03 被阅读18次

    1.隐藏多余的tableView的cell分割线

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

    2.取消系统自带的返回字样

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

    3.滑动时隐藏navigation

    self.navigationController.hidesBarsOnSwipe=YES;

    4.页面跳转是隐藏tabBar

    TwoViewController *twoVC = [[TwoViewController alloc] init];

    twoVC.hidesBottomBarWhenPushed =YES;

    5.ScrollView不能滑到顶

    self.automaticallyAdjustsScrollViewInsets=NO;

    6.按钮点击发光效果

    button.showsTouchWhenHighlighted =YES;

    7.长按手势只执行一次

    if(sender.state == UIGestureRecognizerState)

    8.隐藏状态栏

    - (BOOL)prefersStatusBarHidden

    {

    returnYES;

    }

    9.在使用view的缩放的时候,layer.border.width随着view的放大,会出现锯齿化的问题。

    self.layer.allowsEdgeAntialiasing = YES;

    10、在自定义返回按钮的时候,侧滑手势返回往往默认失效了,怎么让侧滑有效呢

        UIButton  *btn =[UIButton buttonWithType:UIButtonTypeCustom];

        [btn setTitle:@"返回" forState:UIControlStateNormal];

        [btn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];

        btn.frame=CGRectMake(0, 0, 60, 40);

        [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

        UIBarButtonItem  *item =[[UIBarButtonItem alloc]initWithCustomView:btn];

        self.navigationItem.leftBarButtonItem=item;

    添加下面这一句代码即可

     self.navigationController.interactivePopGestureRecognizer.delegate=(id)self;

    相关文章

      网友评论

          本文标题:10个开发小技巧

          本文链接:https://www.haomeiwen.com/subject/lzavhttx.html