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

nav_bar_button class method #272

Closed
jamonholmgren opened this issue Aug 15, 2013 · 4 comments
Closed

nav_bar_button class method #272

jamonholmgren opened this issue Aug 15, 2013 · 4 comments
Assignees

Comments

@jamonholmgren
Copy link
Owner

class MyScreen < PM::Screen
  title "My Screen"
  nav_bar_button :back, title: 'Back', style: :plain, action: :back

  def on_load
    puts "Nav bar enabled."
  end
end
@bitgangsta
Copy link
Contributor

I like this a lot. The only thing that has been scratching my head sometimes is the load order of things under RubyMotion. I know you can configure dependancies in App, but I still find issues sometimes (particularly with things like fonts being registered etc). By making this a class method, are we going to hit any similar limitations?

Diving into the Teacup source, they solve this issue elegantly by storing styles until they are needed / queried. So perhaps I suggest evaluating the actual call during on_init rather than when the class itself is instantiated. What do you think?

I know it would help me as I'm trying to use a custom font. Perhaps others will hit similar roadblocks.

Daniel

@bitgangsta
Copy link
Contributor

(i.e. the class-level nav_bar_button just stores its args, but doesn't actually call set_nav_bar_button until on_create or something)

@jamonholmgren
Copy link
Owner Author

That's my thought as well, except I plan to add it in the add_nav_bar call:

https://github.com/clearsightstudio/ProMotion/blob/edge/lib/ProMotion/screen/screen_module.rb#L48

ryanlntn added a commit to ryanlntn/ProMotion that referenced this issue Jan 21, 2015
…ightstudio/ProMotion into feature/navbarbutton-class-method

* 'feature/navbarbutton-class-method' of github.com:clearsightstudio/ProMotion:
  implemented nav_bar_button class method RE jamonholmgren#272
ryanlntn added a commit to ryanlntn/ProMotion that referenced this issue Jan 21, 2015
* feature/navbarbutton-class-method:
  implemented nav_bar_button class method RE jamonholmgren#272
@ryanlntn
Copy link
Contributor

@jamonholmgren I'm closing this since it looks like this was resolved back in February with the 2.3 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants