Skip to content

Instantly share code, notes, and snippets.

@tehprofessor
Last active December 18, 2015 01:29
Show Gist options
  • Save tehprofessor/5704021 to your computer and use it in GitHub Desktop.
Save tehprofessor/5704021 to your computer and use it in GitHub Desktop.
RubyMotion Example: Promotion Screen using Grouper's FlatUIKit w/ navigation bar
class RootScreen < ProMotion::Screen
title "Bienvenue"
def will_appear
UIBarButtonItem.configureFlatButtonsWithColor([89, 91, 91].uicolor, highlightedColor: [64, 65, 65].uicolor, cornerRadius: 2.0)
set_navigation_appearnce!
set_attributes self.view, {
backgroundColor: [222, 226, 225].uicolor
}
@label ||= UILabel.alloc.initWithFrame(CGRectZero)
@label.text = "Application"
@label.sizeToFit
@label.font = "Hattori_Hanzo-webfont".uifont(16)
@label.backgroundColor = [42, 47, 48].uicolor
@label.textColor = [198, 200, 200].uicolor
@label.center = CGPointMake(self.view.frame.size.width / 2, self.view.frame.size.height / 3)
add @label
end
def set_navigation_appearnce!
@navigation_appearance = UINavigationBar.appearance
@navigation_appearance.configureFlatNavigationBarWithColor [89, 91, 91].uicolor
@navigation_appearance.setTitleTextAttributes({
UITextAttributeTextShadowColor => UIColor.colorWithWhite(0.0, alpha:0.0),
UITextAttributeTextColor => [198, 200, 200].uicolor
})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment