Module: MotionFloatingActionButton

Defined in:
lib/motion-floating-action-button/motion-floating-action-button.rb

Class Method Summary collapse

Class Method Details

.build(args) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/motion-floating-action-button/motion-floating-action-button.rb', line 44

def build(args)

  @floating_frame = args[:floating_frame] || CGRectMake(device.width*3/4, device.height/2, device.width*1/4, device.height/2)
  @normal_image = args[:normal_image]
  @pressed_image = args[:pressed_image]
  @navigation_bar = args[:navigation_bar]

  # addButton = VCFloatingActionButton.alloc.initWithFrame(@floating_frame, normalImage: @normal_image, andPressedImage: @pressed_image) #, withScrollview: UITableView.new)
  addButton = VCFloatingActionButton.alloc.initWithFrame(@floating_frame, normalImage: @normal_image, andPressedImage: @pressed_image, andNavigationBar: @navigation_bar)

  addButton
end

.new(floating_frame, options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/motion-floating-action-button/motion-floating-action-button.rb', line 5

def new(  floating_frame, 
          options
        )

  normal_image = options[:normal_image] || UIImage.imageNamed('plus')
  pressed_image = options[:pressed_image] || UIImage.imageNamed('plus')
  navigation_bar = options[:navigation_bar]
  scroll_view = options[:scroll_view]

  if scroll_view && navigation_bar
    addButton = VCFloatingActionButton.alloc.initWithFrame(floating_frame, 
      normalImage: normal_image, 
      andPressedImage: pressed_image,
      withScrollview: scroll_view,
      andNavigationBar: navigation_bar
    )
  elsif scroll_view
    addButton = VCFloatingActionButton.alloc.initWithFrame(floating_frame, 
      normalImage: normal_image, 
      andPressedImage: pressed_image, 
      withScrollview: scroll_view,
    )
  elsif navigation_bar
    addButton = VCFloatingActionButton.alloc.initWithFrame(floating_frame, 
      normalImage: normal_image, 
      andPressedImage: pressed_image, 
      andNavigationBar: navigation_bar
    )
  else
    addButton = VCFloatingActionButton.alloc.initWithFrame(floating_frame, 
      normalImage: normal_image, 
      andPressedImage: pressed_image
    )
  end

  addButton
end