zoukankan      html  css  js  c++  java
  • iOS常用小知识纪录

    空位补0:   [NSString stringWithFormat:@"%ld:%02ld",(long)self.hour,(long)self.minute];

    给view设置圆角:  bgView.layer.cornerRadius = 8.;

    圆形的Button : startBtn.layer.cornerRadius = 39.;//(大约这个值,就为圆形了。)

     startBtn.layer.borderWidth = 1.0;

     startBtn.layer.borderColor =[UIColor blueColor].CGColor;

     startBtn.clipsToBounds = YES;//去除边界

    给UIView设置图片

     UIImage *image = [UIImage imageNamed:@"xxxxx"];

     UIView *myView = [[UIView alloc] init];

     myView.backgroundColor = [UIColor colorWithPatternImage:image];

    // 设置左上右上角为圆角   

    UIView *alertTimerView = [[UIView alloc] init];
    
    alertTimerView.center = CGPointMake(MainScreenWidth * 0.5, MainScreenHeight * 0.5);
    
    alertTimerView.bounds = CGRectMake(0, 0, alertTimerViewW, alertTimerViewH);
    
    alertTimerView.backgroundColor = [UIColor colorWithPatternImage:image];
    
    alertTimerView.layer.cornerRadius = alertTimerViewCornerRadius;
    
    UIBezierPath *topBezierPath = [UIBezierPath bezierPathWithRoundedRect:alertTimerView.bounds byRoundingCorners:UIRectCornerTopLeft |UIRectCornerTopRight cornerRadii:CGSizeMake(alertTimerViewCornerRadius , alertTimerViewCornerRadius)];
    
    CAShapeLayer *topMaskLayer = [CAShapeLayer layer];
    
    topMaskLayer.frame = alertTimerView.bounds;
    topMaskLayer.path = topBezierPath.CGPath;
    alertTimerView.layer.mask = topMaskLayer;
    
    [self.view addSubview:alertTimerView];
    // 刷新指定行

      NSIndexPath *path = [NSIndexPath indexPathForRow:alertView.tag inSection:0];

         [self.tableview reloadRowsAtIndexPaths:@[path] withRowAnimation:UITableViewRowAnimationRight];



    // 刷新指定collectionView

      NSIndexPath *path = [NSIndexPath indexPathForRow:indexPath.row inSection:0];

         [self.collectionView reloadItemsAtIndexPaths:@[path]];

     //  遍历打印数组

      NSEnumerator *enu = [_selectTreats objectEnumerator];

        id obj;

        while (obj = enu.nextObject) {

            NSLog(@"obj===%@==",obj);

        }    

        [_selectTreats enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(id str,NSUInteger index, BOOL* te){

            NSLog(@"%@,%d",str,index);

        }];

  • 相关阅读:
    List<Object> 查询解析优化
    hibernate 中 query.list()的优化
    移动端屏幕宽度自适应原理及实现
    js获取用户当前地理位置(省、市、经纬度)
    mescroll.js简单的上拉加载、下拉刷新插件,带完整注释
    Web前端性能优化总结——如何提高网页加载速度
    浏览器渲染页面的原理及流程
    优酷1080p的kux格式文件怎么转换为MP4格式?
    js处理文章详情页点击量统计
    plupload上传视频插件jQuery+php
  • 原文地址:https://www.cnblogs.com/pjl111/p/4554697.html
Copyright © 2011-2022 走看看