美文网首页
iOS 随笔

iOS 随笔

作者: Ame___ | 来源:发表于2020-03-16 10:02 被阅读0次

    1.设置导航栏透明 Item 不透明 同时修改适应的title文字颜色

    [self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics: UIBarMetricsDefault];
    
    [self.navigationBar setShadowImage:[UIImage new]];
    
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor whiteColor]};
    

    2.view添加渐变色

    CAGradientLayer *gradient = [CAGradientLayer layer];
    
    gradient.frame = colorView.bounds;gradient.colors = [NSArrayarrayWithObjects: 
    
                                     (id)[UIColorcolorWithRed:0green:143/255.0blue:234/255.0alpha:1.0].CGColor, 
    
                                     (id)[UIColorcolorWithRed:0green:173/255.0blue:234/255.0alpha:1.0].CGColor, 
    
                                     (id)[UIColorwhiteColor].CGColor, nil];
    
    [self.view.layer addSublayer: gradient];
    

    3.时间显示上午或者下午

    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    
    formatter.AMSymbol = @"AM";
    
    formatter.PMSymbol = @"PM";
    
    formatter.dateFormat = @"hh:mm aaa";
    
    NSString*dateStr = [formatter stringFromDate: date];
    

    4.scroll delegate 判断手指移动变化

        CGPoint point =  [scrollView.panGestureRecognizer  translationInView: self.view];
    判断point变化 判断手势方向
    
    CATransaction.begin()
    
     CATransaction.setCompletionBlock {
    
      self.tableView.reloadData()
    
    }
    
     self.tableView.beginUpdates()
    
     self.tableView.deleteRows(at: [(NSIndexPath(row: idx, section: 0) as IndexPath)], with: .left)
    
     self.tableView.endUpdates()
    
     CATransaction.commit()
    

    相关文章

      网友评论

          本文标题:iOS 随笔

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