Skip to content

Instantly share code, notes, and snippets.

@tehprofessor
Last active December 18, 2015 00:18
Show Gist options
  • Save tehprofessor/5695339 to your computer and use it in GitHub Desktop.
Save tehprofessor/5695339 to your computer and use it in GitHub Desktop.
No method error when trying to use FlatUIKit's configureFlatButtonsWithColor https://github.com/Grouper/FlatUIKit
# Notes:
#
# FlatUIKit: https://github.com/Grouper/FlatUIKit
#
# Their Example:
# [UIBarButtonItem configureFlatButtonsWithColor:[UIColor peterRiverColor]
# highlightedColor:[UIColor belizeHoleColor]
# cornerRadius:3];
#
#
# I am using ProMotion and Sugarcube... I am able to use FlatUIKit to style the navigation bar
# but I can't for the life of me get it to style the buttons. I think I am calling the method
# correctly, but it toally fails. I am not sure what I'm doing wrong, or even where to look! :(
#
# me = rubymotion noob
#
class HomeScreen < ProMotion::Screen
title "HomeScreen"
def will_appear
# No Method Error `configureFlatButtonsWithColor`
UIBarButtonItem.appearance.configureFlatButtonsWithColor(UIColor.whiteColor, highlightedColor: "#2DA5FA".uicolor, cornerRadius: 2)
@nav_bar = UINavigationBar.appearance
# This works! Totally styles the navigation bar with FlatUIKIT
@nav_bar.configureFlatNavigationBarWithColor("#1FA1F8".uicolor)
@nav_bar.setTitleTextAttributes({
UITextAttributeTextShadowColor => UIColor.colorWithWhite(0.0, alpha:0.0),
UITextAttributeTextColor => UIColor.whiteColor
})
navigationItem.rightBarButtonItem = UIBarButtonItem.alloc.initWithTitle("Login", style: UIBarButtonItemStylePlain, target:self, action:'login')
set_attributes self.view, {
backgroundColor: UIColor.whiteColor
}
end
def login
puts "Login button clicked"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment