Class: Sharemotion::Sheet

Inherits:
UIActionSheet
  • Object
show all
Defined in:
lib/sharemotion/sheet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



6
7
8
# File 'lib/sharemotion/sheet.rb', line 6

def controller
  @controller
end

#sharersObject (readonly)

Returns the value of attribute sharers.



6
7
8
# File 'lib/sharemotion/sheet.rb', line 6

def sharers
  @sharers
end

#title=(value) ⇒ Object (writeonly)

Sets the attribute title

Parameters:

  • value

    the value to set the attribute title to.



5
6
7
# File 'lib/sharemotion/sheet.rb', line 5

def title=(value)
  @title = value
end

Instance Method Details

#actionSheet(action_sheet, clickedButtonAtIndex: index) ⇒ Object



24
25
26
# File 'lib/sharemotion/sheet.rb', line 24

def actionSheet(action_sheet, clickedButtonAtIndex:index)
  @sharers[index].share(@controller) unless self.cancelButtonIndex == index
end

#initWithSharers(sharers, controller: controller) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



8
9
10
11
12
13
14
15
# File 'lib/sharemotion/sheet.rb', line 8

def initWithSharers(sharers, controller:controller, &block)
  @sharers, @controller = sharers, controller
  self.initWithTitle(nil, delegate:self, cancelButtonTitle:nil, 
    destructiveButtonTitle:nil, otherButtonTitles:nil)
  self.sheet_configuration
  yield(self) if block_given?
  self
end

#sheet_configurationObject



17
18
19
20
21
22
# File 'lib/sharemotion/sheet.rb', line 17

def sheet_configuration
  @sharers.each { |s| self.addButtonWithTitle(s.sharer_title) }
  self.cancelButtonIndex = self.addButtonWithTitle(
    BW.localized_string(:shm_cancel, 'Cancel'))
  self.title = "Share"
end