
我想使透明的颜色在我的滑出菜单像youtube,有什么想法吗?请帮帮忙!
发布于 2015-01-21 10:07:00
您可以使用、iOS 8、、默认UIVisualEffect和UIVisualEffectView轻松添加模糊效果,确保它只在iOS 8之上可用。
UIVisualEffect *blurV = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *visualV = [[UIVisualEffectView alloc] initWithEffect:blurV];
visualV.frame = yourImageView.bounds;
[yourImageView addSubview:visualEffectView];您可以添加三种默认效果之一
typedef NS_ENUM(NSInteger, UIBlurEffectStyle) {
UIBlurEffectStyleExtraLight,
UIBlurEffectStyleLight,
UIBlurEffectStyleDark
} NS_ENUM_AVAILABLE_IOS(8_0);斯威夫特
var visualV = UIVisualEffectView(effect: UIBlurEffect(style: .Dark)) as UIVisualEffectView
visualV.frame = yourImageView.bounds
yourImageView.addSubview(visualV)发布于 2015-01-21 10:19:47
试试这个:
override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell?
{
println("The indexPath code is \(indexPath!.row)")
let cell = tableView!.dequeueReusableCellWithIdentifier("FlowerTableViewCell", forIndexPath: indexPath) as FlowerTableViewCell
let flower = flowers[indexPath!.row] as Flower
let backgroundImageView = UIImageView(image: UIImage(named: flower.backgroundImage))
cell.backgroundView = backgroundImageView
var visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light)) as UIVisualEffectView
visualEffectView.frame = CGRectMake(0, 0, cell.bounds.width, cell.bounds.height)
backgroundImageView.addSubview(visualEffectView)
cell.textLabel.text = flower.name
cell.textLabel.textColor = UIColor.whiteColor()
cell.textLabel.backgroundColor = UIColor.clearColor()
return cell
}希望这能帮到你。您也可以在这篇博客文章上看一看:http://blog.bubbly.net/2013/09/11/slick-tricks-for-ios-blur-effect/
https://stackoverflow.com/questions/28064306
复制相似问题