Sha256: 083cdb7ca2c5bb0d7c1db9f6aea0db0959f93d8e8a790daefda0d953470f2f5c

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

module StatusBar
  class Helper
    
    class << self

      def label_color
        color = UIColor.blackColor
        case App.shared.statusBarStyle
        when UIStatusBarStyleDefault
          color = "#bcbcbc".uicolor unless HS::Base.ios_7?
        when UIStatusBarStyleLightContent
          color = "#ffffff".uicolor
        end
        return color
      end

      def label_font
        UIFont.boldSystemFontOfSize(HS::Base.ios_7? ? 12 : 14)
      end

      def label_alignment
        HS::Base.ios_6? ? UITextAlignmentCenter : NSTextAlignmentCenter
      end

      def textwidth(text)
        text.sizeWithFont(label_font).width
      end

      def accessory_x(text)
        (HS::Base.rotation_width/2) - (textwidth(text) / 2) - 10
      end

      def label_x(text)
        (HS::Base.rotation_width/2) - (textwidth(text) / 2)
      end

      def view_visible?(view)
        view.y == 0
      end

      def label(view)
        return_view = nil
        view.subviews.each do |subview|
          return_view = subview if subview.class == UILabel
        end
        return return_view
      end

      def accessory(view)
        return_view = nil
        view.subviews.each do |subview|
          return_view = subview if subview.class == UIActivityIndicatorView || subview.class == UIImageView
        end
        return return_view
      end
    
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
status_bar-0.2.3 lib/project/helper.rb
status_bar-0.2.2 lib/project/helper.rb
status_bar-0.2.1 lib/project/helper.rb
status_bar-0.2 lib/project/helper.rb