diff --git a/README.md b/README.md index 0e99334..7df2e3a 100755 --- a/README.md +++ b/README.md @@ -119,9 +119,9 @@ for **bleeding edge**, add this to your `Gemfile`: *Clone this repo and run the example app to see an example of use.* - git clone git@github.com:infinitered/rmq.git - cd rmq - rake + git clone git@github.com:infinitered/rmq.git + cd rmq + rake The example app works in any orientation, on both iPhone and iPad. Notice how the benchmark popup is done with RMQ, then think about how you'd do that without it. @@ -268,7 +268,7 @@ I recomend you play around with it, do this: - my_view_instance - text: 'you can select via attributes also' - :another_tag, UILabel, text: 'an array' <- this is an "or", use .and for and - + The more common use is to select any view or views you have assigned to variables, then perform actions on them. For example: ```ruby @@ -377,8 +377,8 @@ The rest of traversing isn't used too often, but when you need it, it's super ha - all - closest - find - -These are less common: + +These are less common: - and - not @@ -500,7 +500,7 @@ rmq(UIView).on(:tap){|sender| rmq(sender).hide} # Adding an Event during creation view_q = rmq.append(UIView).on(:tap) do |sender, event| - # do something here + # do something here end # removing an Event @@ -845,7 +845,7 @@ rmq.device.iphone? rmq.device.four_inch? rmq.device.retina? -# return values are :unknown, :portrait, :portrait_upside_down, :landscape_Left, +# return values are :unknown, :portrait, :portrait_upside_down, :landscape_left, # :landscape_right, :face_up, :face_down rmq.device.orientation rmq.device.landscape? @@ -1314,7 +1314,7 @@ end ``` ##### UIControlStyler - Nothing yet + Nothing yet ##### UILabelStyler diff --git a/motion/ruby_motion_query/device.rb b/motion/ruby_motion_query/device.rb index ac55fe3..e9bb420 100644 --- a/motion/ruby_motion_query/device.rb +++ b/motion/ruby_motion_query/device.rb @@ -58,11 +58,12 @@ module RubyMotionQuery # @return :unknown or from ORIENTATIONS def orientation - ORIENTATIONS[UIDevice.currentDevice.orientation] || :unknown + orientation = UIApplication.sharedApplication.statusBarOrientation + ORIENTATIONS[orientation] || :unknown end def landscape? - Device.orientation == :landscape_Left || Device.orientation == :landscape_right + Device.orientation == :landscape_left || Device.orientation == :landscape_right end def portrait? @@ -77,7 +78,7 @@ module RubyMotionQuery UIDeviceOrientationUnknown => :unknown, UIDeviceOrientationPortrait => :portrait, UIDeviceOrientationPortraitUpsideDown => :portrait_upside_down, - UIDeviceOrientationLandscapeLeft => :landscape_Left, + UIDeviceOrientationLandscapeLeft => :landscape_left, UIDeviceOrientationLandscapeRight => :landscape_right, UIDeviceOrientationFaceUp => :face_up, UIDeviceOrientationFaceDown => :face_down diff --git a/motion/ruby_motion_query/stylesheet.rb b/motion/ruby_motion_query/stylesheet.rb index 2cd8f6f..bb369cc 100644 --- a/motion/ruby_motion_query/stylesheet.rb +++ b/motion/ruby_motion_query/stylesheet.rb @@ -52,7 +52,7 @@ module RubyMotionQuery end def styler_for(view) - # TODO should have a pool of stylers to reuse, or just assume single threaded and + # TODO should have a pool of stylers to reuse, or just assume single threaded and # memoize this, however if you do that, make sure the dev doesn't retain them in a var custom_stylers(view) || begin case view @@ -110,13 +110,13 @@ module RubyMotionQuery unless Stylesheet.application_was_setup Stylesheet.application_was_setup = true - application_setup + application_setup end setup end def application_setup - # Override to do your overall setup for your applications. This + # Override to do your overall setup for your applications. This # is where you want to add your custom fonts and colors # This only gets called once end @@ -175,11 +175,11 @@ module RubyMotionQuery end def app_width - landscape? ? app_size.width : app_size.height + portrait? ? app_size.width : app_size.height end def app_height - landscape? ? app_size.height : app_size.width + portrait? ? app_size.height : app_size.width end def app_size @@ -187,11 +187,11 @@ module RubyMotionQuery end def screen_width - landscape? ? screen_size.width : screen_size.height + portrait? ? screen_size.width : screen_size.height end def screen_height - landscape? ? screen_size.height : screen_size.width + portrait? ? screen_size.height : screen_size.width end def screen_size