iphone-- UIView 加入边框,阴影,圆角

    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(7, 38, 306, 360)];
    [searchTableView setBackgroundColor:[UIColor whiteColor]];

    //圆角
    searchTableView.layer.cornerRadius = 6.0f;
    searchTableView.hidden = YES;

    //阴影
    searchTableView.layer.shadowColor = [UIColor colorWithRed:163.0/255 green:163.0/255 blue:163.0/255 alpha:1].CGColor;
    searchTableView.layer.shadowOffset = CGSizeMake(2, 2);
    searchTableView.layer.shadowRadius = 0.6f;

    //边框
    searchTableView.layer.masksToBounds=YES;      
    searchTableView.layer.borderWidth=1.0;      
    searchTableView.layer.borderColor=[[UIColor colorWithRed:163.0/255 green:163.0/255 blue:163.0/255 alpha:1] CGColor];


当对控件加入阴影之后,再对UIView进行动画有时会出现卡的情况,动画不流畅(在真机上会更加明显)

可以用以下方法对阴影进行控制

    view.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:view.frame cornerRadius:0].CGPath;


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值