UIView相关

设置部分圆角

dispatch_async(dispatch_get_main_queue(), ^{
                    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:cell.tipBgImgView.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomRight cornerRadii:CGSizeMake(18*hzoom, 18*hzoom)];
                    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
                    maskLayer.frame = cell.tipBgImgView.bounds;
                    maskLayer.path = maskPath.CGPath;
                    cell.tipBgImgView.layer.mask = maskLayer;
                });

阴影效果

UIView *shadowView = [[UIView alloc]initWithFrame:CGRectMake(40*wzoom, 88*hzoom, ScreenWidths-80*wzoom, 254*hzoom)];
    [_headBgView addSubview:shadowView];
    
    shadowView.layer.shadowColor = Gray201.CGColor;
    shadowView.layer.shadowOffset = CGSizeMake(0, 0);
    shadowView.layer.shadowOpacity = 0.8;
    shadowView.layer.shadowRadius = 14.0;
    shadowView.layer.cornerRadius = 14.0;
    
    _scrolWhiteBgView = [[UIView alloc] initWithFrame:shadowView.bounds];
    _scrolWhiteBgView.layer.masksToBounds = YES;
    _scrolWhiteBgView.layer.cornerRadius = 14;
    _scrolWhiteBgView.backgroundColor = White;
    [shadowView addSubview:_scrolWhiteBgView];

1.圆角

[view.layer setCornerRadius:3];
view.layer.masksToBounds = YES;

2.边框

view.layer.borderWidth = 1.0;
view.layer.borderColor = [[UIColor redColor] CGColor];

3.移除子控件

for(UIView *view in [view subviews])
        {
            [view removeFromSuperview];
        }

4.自定义菊花

1.新建一个类MyActivityIndicatorView,继承于UIActivityIndicatorView,添加初始化方法

先定义宏(模拟器为iPhone6)


 

    #define kWidth 375

    #define KHeight 667

    #define MYCOLOR [UIColor blackColor]

    - (id)initWithFrame:(CGRect)frame

    {

    self = [super initWithFrame:frame];

    if (self) {

    // 菊花背景的大小

    self.frame = CGRectMake(kWidth/2-50, KHeight/2-50, 100, 100);

    // 菊花的背景色

    self.backgroundColor = MYCOLOR;

    self.layer.cornerRadius = 10;

    // 菊花的颜色和格式(白色、白色大、灰色)

    self.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;

    // 在菊花下面添加文字

    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 60, 80, 40)];

    label.text = @"loading...";

    label.font = [UIFont systemFontOfSize:14];

    label.textAlignment = NSTextAlignmentCenter;

    label.textColor = [UIColor whiteColor];

    [self addSubview:label];

    }

    return self;

    }

2.在加载网络之前调用该方法


 

    // 自带菊花方法

    self.myActivityIndicatorView = [[MyActivityIndicatorView alloc]init];

    [self.view addSubview:_myActivityIndicatorView];

    // 动画开始

    [_myActivityIndicatorView startAnimating];


3.网络请求完成,数据加载后调用取消动画方法

    // 动画结束

    [_myActivityIndicatorView stopAnimating];

5.禁止屏幕旋转

- (BOOL)shouldAutorotate {
    return NO;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值