Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply styles to UIButton Inner Objects #331

Open
augustosamame opened this issue Jul 18, 2017 · 0 comments
Open

Apply styles to UIButton Inner Objects #331

augustosamame opened this issue Jul 18, 2017 · 0 comments

Comments

@augustosamame
Copy link

augustosamame commented Jul 18, 2017

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant