Jonathan Clark
Jonathan Clark

Reputation: 20538

How to use custom background image or color using Promotion

I am trying to build an iOS app using Promotion. It works fine as long as I use the build in default design. But I want to be able to style for example the navbar as I want (different colors and different background images).

How can I do this using Promotion?

Thanks!

Upvotes: 0

Views: 770

Answers (1)

Arkan
Arkan

Reputation: 6236

You can use Teacup to easily customize your views. https://github.com/rubymotion/teacup

Add teacup to your gemfile, create a file appearence.rb in app/styles/appearence.rb and paste the following code:

Teacup::Appearance.new do

  style UINavigationBar, {
    tintColor: UIColor.blackColor
  }

  style UIBarButtonItem, {
    tintColor: UIColor.blackColor
  }

  style UITableViewCell, {
    layer: {  # style the layer!
      shadowRadius: 3
    },
    backgroundView: {  # style the background!
      backgroundColor: UIColor.blackColor
    },
    imageView: {  # style the imageView!
      contentMode: UIViewContentModeScaleAspectFill
    }
  }

  style UISearchBar, {
    tintColor: UIColor.colorWithRed(0.733, green:0.733, blue:0.733, alpha:1)
  }
end

Add this line to your app delegate before loading your views

Teacup::Appearance.apply

Hope it helps.

Upvotes: 2

Related Questions