@@ -39,7 +39,10 @@ extension UIViewController{
39
39
let barButton = UIButton ( type: . Custom)
40
40
barButton. frame = CGRectMake ( 0 , 0 , 45 , 40 )
41
41
barButton. backgroundColor = UIColor . clearColor ( )
42
- barButton. addTarget ( self , action: Selector ( position. rawValue) , forControlEvents: . TouchUpInside)
42
+ // return self.scheduledTimerWithTimeInterval(timeInterval, target: self, selector: #selector(NSTimer.executeBlockWithTimer(_:)), userInfo: unsafeBitCast(block, AnyObject.self), repeats: repeats)
43
+
44
+ // barButton.addTarget(self, action: Selector(position.rawValue), forControlEvents: .TouchUpInside)
45
+ barButton. addTarget ( self , action: ( position == . NavigationBarButtonAsLeft) ? #selector( UIViewController . leftBarButtonAction ( _: ) ) : #selector( UIViewController . rightBarButtonAction ( _: ) ) , forControlEvents: . TouchUpInside)
43
46
barButton. imageView? . contentMode = . ScaleAspectFit
44
47
if let image = normalImage{
45
48
barButton. setImage ( image, forState: . Normal)
@@ -109,7 +112,7 @@ extension UIViewController{
109
112
110
113
}
111
114
112
- @objc func leftBarButtonAction( sender: UIButton ? )
115
+ @objc private func leftBarButtonAction( sender: UIButton ? )
113
116
{
114
117
let switchEffect = objc_getAssociatedObject ( self , & AssociatedKeys. SwitchEffectKey) as? Bool
115
118
if let _ = switchEffect {
@@ -126,7 +129,7 @@ extension UIViewController{
126
129
block ( barButton: sender)
127
130
}
128
131
129
- @objc func rightBarButtonAction( sender: UIButton ? )
132
+ @objc private func rightBarButtonAction( sender: UIButton ? )
130
133
{
131
134
let switchEffect = objc_getAssociatedObject ( self , & AssociatedKeys. SwitchEffectKey) as? Bool
132
135
if let _ = switchEffect {
0 commit comments