利用阴影增加模块的立体感

  这是一种利用贝塞尔曲线显示阴影增加模块立体感的方法

  

具体代码如下

  

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(100, 200, 200, 200)];

    

    [imageView setImage:[UIImage imageNamed:@"001"]];

    

    UIBezierPath *shadowPath = [UIBezierPath bezierPathWithRect:imageView.bounds];

    

    imageView.layer.masksToBounds = NO;

    

    imageView.layer.shadowColor = [UIColor blackColor].CGColor;

    

    imageView.layer.shadowOffset = CGSizeMake(0.0f, 5.0f);

    

    imageView.layer.shadowOpacity = 0.5f;

    

    imageView.layer.shadowPath = shadowPath.CGPath;

    

    [self.view addSubview:imageView];

 

posted on 2016-08-19 13:39  var_King  阅读(298)  评论(0)    收藏  举报

导航