Class: Loco::UI::Label

Inherits:
UILabel
  • Object
show all
Includes:
Observable, Resizable
Defined in:
lib/motion-loco/views.rb

Instance Attribute Summary

Attributes included from Resizable

#bottom, #height, #left, #parent_view, #right, #top, #width

Instance Method Summary collapse

Methods included from Observable

#init, #initWithFrame, #initWithStyle, #initialize, #method_missing, #register_observer, #remove_all_observers, #remove_observer, #set_properties, #update_attributes

Methods included from Resizable

#initWithFrame, #refresh_layout, #viewSetup, #view_setup, #willMoveToSuperview

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Loco::Observable

Instance Method Details

#text_alignObject Also known as: textAlign



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/motion-loco/views.rb', line 27

def text_align
  case self.textAlignment
  when NSTextAlignmentLeft
    'left'
  when NSTextAlignmentCenter
    'center'
  when NSTextAlignmentRight
    'right'
  when NSTextAlignmentJustified
    'justified'
  when NSTextAlignmentNatural
    'natural'
  end
end

#text_align=(alignment) ⇒ Object Also known as: textAlign=



43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/motion-loco/views.rb', line 43

def text_align=(alignment)
  case alignment
  when 'left'
    self.textAlignment = NSTextAlignmentLeft
  when 'center'
    self.textAlignment = NSTextAlignmentCenter
  when 'right'
    self.textAlignment = NSTextAlignmentRight
  when 'justified'
    self.textAlignment = NSTextAlignmentJustified
  when 'natural'
    self.textAlignment = NSTextAlignmentNatural
  end
end

#textAlignment=(alignment) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/motion-loco/views.rb', line 59

def textAlignment=(alignment)
  if alignment.is_a? String
    self.text_align = alignment
  else
    super
  end
end