pm_swipe_cells 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13bba2955e371e6eebd622d359bab7d84541f681
4
- data.tar.gz: caffab3a5c8b128f21184238ea7637662c49beca
3
+ metadata.gz: a6af2793f8ba8f9104b974238ec6ad2c49764f2e
4
+ data.tar.gz: 78728e25f973e126f9b67daa9eef03bcac8a28e5
5
5
  SHA512:
6
- metadata.gz: 9ac17f4f8492dcf0476f2303e0786709987589c27cdf18245ffd10b1f6e47fd37f756f64b848a7ea096c09bdb2292323c6a772fb460123033b366439442e02ea
7
- data.tar.gz: 3589af61e92e9d024b345e1f55fdd19dc719ab15671b2f28fde69a56a0b8b9eaf6b124beecd846df994471ad17887dd6b300146935165b8e432a51dab8cd04e0
6
+ metadata.gz: e6011fe8d6f3b4c1dfbcec3b21c502799199dca8f7175035911ca9cfe9ccff65dd51745a6ca8f3c5282576c4b205bc8c5ec791d6354f39a436c0c94294a9f1a8
7
+ data.tar.gz: f1e44f12e375ddac5fd2e60d086fb55a9e55faebefb8a3072c9d0f6bcfdbaef4e5484799d70d12e830c7aff0a697bb26672c1d3d715a446622382cd163717ded
data/README.md CHANGED
@@ -59,6 +59,8 @@ Each array takes up to 4 parameters, one of which is required:
59
59
  + *color*: A UIColor for the button's background (defaults to UIColor.blueColor).
60
60
 
61
61
  + *title*: The text displayed on the button (defaults to the action name).
62
+
63
+ + *icon*: An UIImage used as an icon in place of a title.
62
64
 
63
65
  - **Optional**
64
66
 
@@ -7,6 +7,7 @@ module ProMotion
7
7
 
8
8
  cell.setDelegate((data[:delegate].nil? ? self : data[:delegate])) if cell.respond_to?(:"setDelegate:")
9
9
  if data[:properties]
10
+ data[:properties].reject{|k,v| [:right_buttons, :left_buttons].include?(k)}.each {|k,v| cell.send("#{k}=", v) if cell.respond_to?("#{k}=")}
10
11
  cell.config(right_buttons: data[:properties][:right_buttons], left_buttons: data[:properties][:left_buttons]) if cell.respond_to?(:config)
11
12
  end
12
13
  end
@@ -6,9 +6,13 @@ class SwipeableCell < SWTableViewCell
6
6
  def add_right_buttons(cells_to_add = {})
7
7
  @right_buttons_array = Array.new
8
8
  cells_to_add.each do |opts|
9
- opts[:title] ||= opts[:action].to_s
10
9
  opts[:color] ||= UIColor.blueColor
11
- @right_buttons_array.sw_addUtilityButtonWithColor(opts[:color], title: opts[:title].to_s.capitalize)
10
+ if opts[:icon] # Must be a UIImage
11
+ @right_buttons_array.sw_addUtilityButtonWithColor(opts[:color], icon: opts[:icon])
12
+ else
13
+ opts[:title] ||= opts[:action].to_s
14
+ @right_buttons_array.sw_addUtilityButtonWithColor(opts[:color], title: opts[:title].to_s.capitalize)
15
+ end
12
16
  end
13
17
  @right_buttons_array
14
18
  end
@@ -16,9 +20,13 @@ class SwipeableCell < SWTableViewCell
16
20
  def add_left_buttons(cells_to_add = {})
17
21
  @left_buttons_array = Array.new
18
22
  cells_to_add.each do |opts|
19
- opts[:title] ||= opts[:action].to_s
20
23
  opts[:color] ||= UIColor.blueColor
21
- @left_buttons_array.sw_addUtilityButtonWithColor(opts[:color], title: opts[:title].to_s.capitalize)
24
+ if opts[:icon] # Must be a UIImage
25
+ @left_buttons_array.sw_addUtilityButtonWithColor(opts[:color], icon: opts[:icon])
26
+ else
27
+ opts[:title] ||= opts[:action].to_s
28
+ @left_buttons_array.sw_addUtilityButtonWithColor(opts[:color], title: opts[:title].to_s.capitalize)
29
+ end
22
30
  end
23
31
  @left_buttons_array
24
32
  end
@@ -1,3 +1,3 @@
1
1
  module PMSwipeCell
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pm_swipe_cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Egan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-05 00:00:00.000000000 Z
11
+ date: 2015-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ProMotion
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  requirements: []
128
128
  rubyforge_project:
129
- rubygems_version: 2.4.6
129
+ rubygems_version: 2.4.8
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: Add customizable swipe actions to ProMotion table cells