Last active
February 15, 2016 19:49
-
-
Save wess/4362ab0bcb7a9af81e36 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Toolbar.swift | |
// Inquire | |
// | |
// Created by Wesley Cope on 2/15/16. | |
// Copyright © 2016 Wess Cope. All rights reserved. | |
// | |
import Foundation | |
import UIKit | |
public typealias FieldBarButtonHandler = ((sender:AnyObject?) -> Void) | |
public class FieldToolbarItem : UIBarButtonItem { | |
private var handler:FieldBarButtonHandler? | |
public override init() { | |
super.init() | |
} | |
public convenience init(image: UIImage?, style: UIBarButtonItemStyle, handler:FieldBarButtonHandler) { | |
self.init() | |
self.image = image | |
self.style = style | |
self.target = self | |
self.action = "targetAction:" | |
} | |
public convenience init(image: UIImage?, landscapeImagePhone: UIImage?, style: UIBarButtonItemStyle, handler:FieldBarButtonHandler) { | |
self.init() | |
self.image = image | |
self.landscapeImagePhone = landscapeImagePhone | |
self.style = style | |
self.target = self | |
self.action = "targetAction:" | |
} | |
public convenience init(title: String?, style: UIBarButtonItemStyle, handler:FieldBarButtonHandler) { | |
self.init() | |
self.title = title | |
self.style = style | |
self.target = self | |
self.action = "targetAction:" | |
} | |
public init(barButtonSystemItem systemItem: UIBarButtonSystemItem, handler:FieldBarButtonHandler) { | |
self.handler = handler | |
super.init(barButtonSystemItem: systemItem, target: self, action: "targetAction:") | |
// self.init() | |
// super.init(barButtonSystemItem: systemItem, target: target, action: action) | |
} | |
public required init?(coder aDecoder: NSCoder) { | |
fatalError("init(coder:) has not been implemented") | |
} | |
private func targetAction(sender:AnyObject?) { | |
} | |
} | |
public protocol Toolbar { | |
var toolbar:UIToolbar {get} | |
} | |
extension Toolbar { | |
public var toolbar:UIToolbar { | |
let _toolbar = UIToolbar(frame: .zero) | |
return _toolbar | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment