Class: StatusBar::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/project/helper.rb

Class Method Summary collapse

Class Method Details

.accessory(view) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/project/helper.rb', line 49

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

.accessory_x(text) ⇒ Object



29
30
31
# File 'lib/project/helper.rb', line 29

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

.label(view) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/project/helper.rb', line 41

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

.label_alignmentObject



21
22
23
# File 'lib/project/helper.rb', line 21

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

.label_colorObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/project/helper.rb', line 6

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

.label_fontObject



17
18
19
# File 'lib/project/helper.rb', line 17

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

.label_x(text) ⇒ Object



33
34
35
# File 'lib/project/helper.rb', line 33

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

.textwidth(text) ⇒ Object



25
26
27
# File 'lib/project/helper.rb', line 25

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

.view_visible?(view) ⇒ Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/project/helper.rb', line 37

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