SwiftRaisedTab 0.2.0

SwiftRaisedTab 0.2.0

测试测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2015 年 9 月
SPM支持 SPM

Punnawut Khowkittipaiboon 维护。



SwiftRaisedTab

基于此博客文章
http://idevrecipes.com/2010/12/16/raised-center-tab-bar-button

安装

使用以下命令安装 CocoaPods。

$ gem install cocoapods

将以下内容添加到 Podfile 中。

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'SwiftRaisedTab', '~> 0.2.0'

使用方法

从 RaisedTabBarController 继承,并在 viewWillAppearonRaisedButton 中实现以下内容。

要链接到 Storyboard,将新的 TabBarController 拖到 Storyboard 中,并将自定义类更改为您的 RaisedTabBarController 子类。

import UIKit
import SwiftRaisedTab

class ViewController: RaisedTabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

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

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)

        // Insert empty tab item at center index. In this case we have 5 tabs.
        self.insertEmptyTabItem("", atIndex: 2)

        // Raise the center button with image
        let img = UIImage(named: "icon_camera")
        self.addRaisedButton(img, highlightImage: nil)
    }

    // Handler for raised button
    override func onRaisedButton(sender: UIButton!) {
        super.onRaisedButton(sender)

        println("Raised button tapped")
    }

}