小编Nik*_*nov的帖子

Swift中的透明UINavigationBar

我想让我UINavigationBarUINavigationController透明.我创建了一个子类,UINavigationController并喜欢它在我的storyboard文件中的一个场景.这是我的子类的一部分:

override func viewDidLoad() {
    super.viewDidLoad()

    // Do any additional setup after loading the view.
    let size = self.navigationBar.frame.size
    self.navigationBar.setBackgroundImage(imageWithColor(UIColor.blackColor(), size: size, alpha: 0.2), forBarMetrics: UIBarMetrics.Default)
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func imageWithColor(color: UIColor, size: CGSize, alpha: CGFloat) -> UIImage {
    UIGraphicsBeginImageContext(size)
    let currentContext = UIGraphicsGetCurrentContext()
    let fillRect = CGRectMake(0, 0, size.width, size.height)
    CGContextSetFillColorWithColor(currentContext, color.CGColor)
    CGContextSetAlpha(currentContext, alpha)
    CGContextFillRect(currentContext, fillRect)
    let retval: UIImage = …
Run Code Online (Sandbox Code Playgroud)

uinavigationbar ios swift

27
推荐指数
5
解决办法
4万
查看次数

如何从Swift中的数组中获取最新日期

我有一系列日期.我需要找到最新的一个.有人能告诉我一个例子吗?

nsdate ios swift

3
推荐指数
2
解决办法
3291
查看次数

标签 统计

ios ×2

swift ×2

nsdate ×1

uinavigationbar ×1