infinitered / redpotion

We believe iPhone development should be clean, scalable, and fast with a language that developers not only enjoy, but actively choose. With the advent of Ruby for iPhone development the RubyMotion community has combined and tested the most active and powerful gems into a single package called RedPotion
MIT License
234 stars 40 forks source link

Unable to apply style to UIButtonLabel #181

Closed augustosamame closed 6 years ago

augustosamame commented 7 years ago

I am having trouble applying styles on initial load to the inner objects of an UIButton

For example this works and properly styles the label for a button when clicked:

append(UIButton, :lives_counter).on(:tap) do |sender|
  rmq(:lives_counter).children(UIButtonLabel).apply_style(:lives_counter_label)
end

but if I want to apply the style to the UIButtonLabel from the start, it does not work. The style is ignored:

append(UIButton, :lives_counter).on(:tap) do |sender|
end
rmq(:lives_counter).children(UIButtonLabel).apply_style(:lives_counter_label)

This is an UIView I am using for a Table Header. Complete code for view follows:


class HomeTableHeader < UIView
  include PM::Styling

  def on_load

    append(UIButton, :stars_counter).on(:tap) do |sender|

    end
    append(UIButton, :lives_counter).on(:tap) do |sender|
      rmq(:lives_counter).children(UIButtonLabel).apply_style(:lives_counter_label)
    end
    rmq(:lives_counter).children(UIButtonLabel).apply_style(:lives_counter_label)

    append(UIButton, :faces_counter).on(:tap) do |sender|

    end

  end

  def will_appear
    rmq(:lives_counter).children(UIButtonLabel).apply_style(:lives_counter_label)
  end

  def on_appear
    rmq(:lives_counter).children(UIButtonLabel).apply_style(:lives_counter_label)
  end

end
andrewhavens commented 6 years ago

Hi @augustosamame. I'm closing this issue due to inactivity. Let me know if you still have this issue or have any thoughts on it.