87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'motion-prime/screens/extensions/_navigation_bar_mixin.rb', line 87
def create_navigation_button_with_image(title, args)
face = UIButton.buttonWithType UIButtonTypeCustom
if ui_image = args[:image].uiimage
ui_image = ui_image.imageWithRenderingMode(2) if args[:tint_color].present?
face.bounds = CGRectMake(0, 0, ui_image.size.width, ui_image.size.height)
face.setImage ui_image, forState: UIControlStateNormal
end
face.setTintColor(args[:tint_color].uicolor) if args[:tint_color]
face.setImageEdgeInsets(UIEdgeInsetsMake(0, args[:offset_x], 0, -args[:offset_x])) if args[:offset_x]
face.on :touch do
args[:action].to_proc.call(args[:target] || self)
end if args[:action]
UIBarButtonItem.alloc.initWithCustomView(face)
end
|