// Add background tile UIImage *bgImage = [UIImage imageNamed:@"embedded_bg.png"]; self.view.backgroundColor = [UIColor colorWithPatternImage:bgImage]; // Add the reference view UIImage *image = [UIImage imageNamed:@"dccp.jpeg"]; UIImageView *imgView = [[UIImageView alloc] initWithImage:image]; [self.view addSubview:imgView]; imgView.center = self.view.center; imgView.layer.shadowColor = [UIColor blackColor].CGColor; imgView.layer.shadowOpacity = 0.7f; imgView.layer.shadowOffset = CGSizeMake(10.0f, 10.0f); imgView.layer.shadowRadius = 5.0f; imgView.layer.masksToBounds = NO; //如果没有这句,渲染会很卡 UIBezierPath *path = [UIBezierPath bezierPathWithRect:imgView.bounds]; imgView.layer.shadowPath = path.CGPath; [imgView release];
UIImageView 阴影
猜你喜欢
转载自xyxdasnjss.iteye.com/blog/1871039
今日推荐
周排行