motion-prime 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWVjNWJkMDZmYjAxODgwZDZiZDhkMzk1YWU5ODkyYmIwZDMzM2VhNg==
4
+ NDJkNjczMjI4MjA3OTZjZjM5ZGNkOTliZjhiMDMzNGYzM2Q2ODFlNQ==
5
5
  data.tar.gz: !binary |-
6
- ZjkyMzg2NGI3ODZkNDNmNWFjZTU1ZmZmNTNjNmFmMTM3MWI1YTcxYg==
6
+ M2ZjNWU2ZTNiZDlmN2NlNzE1M2QxN2RkOTdhMmFiYTYwZTljOWU3Mg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YzNmZDYwMDU4ZjkxNmQ3Yzc2MTU4MmVkNjg5YzM5MDQ1OWMzMTA5NTMzOWMy
10
- YzI1MTcwMzQ3NDJhYzEwZWUwMTFmYzRlNDY2OWE3YWUzMjE1OTBiMGU5YzYw
11
- ODczMGViYmJlMmMwMjFmMDYwNjZmZWRiZTgwNjVmYTY0YzZjMTQ=
9
+ Y2Y1M2RlNWU3YWRmZjRjNjRkOTBkNDc5NzY4OGY1ODViYzc3YjkxOGI1MzAw
10
+ OTgzZGFkN2FhZGUzZGQ5OTAzYTA2MDlkMTExOGRiNjI4OTdkNmY1NzViN2Fi
11
+ NGE5OWJjZGE1MjY0YzZlNDllZTU4Yjc5Mjg3NTg3MmQ5ODRhYjU=
12
12
  data.tar.gz: !binary |-
13
- YjdmMDBhOTZmYmU4ODk2NGZmMTAzYTY4MTU4YmQxMTFjNGQ4MzAxYTZjMDJi
14
- MDkzYTVhOTVlM2M5NTAxMGVmYWM0ZDVjZjAxNzIwOTlmZjIzNmI2MDg5NDZm
15
- NDkzMmE1MzBkOGViZjg1ODU5MzQyODY2OTZhZWQ5ZDQwZDY2MmM=
13
+ MTU4Zjc1NjgyYzczZDRmNzE0MThhYTI2ZWZmNDdjNzYwNGE2NTNmNzE3Yzc2
14
+ ZWE5NWViNWZkMjkwZjQxOTFjMWI5YjY5MjFjYjdiY2Q1MzJhODJmMjM0NDdk
15
+ YWQ1NDQ4MDQzM2RlOTdhOTI0YTRhNTY5MmQ0NTg1YTZmOTcxZTk=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ === 1.0.1
2
+ * bug fixes
3
+ * support iOS 8
4
+ * start adding PageView support
5
+
1
6
  === 1.0.0
2
7
  * Stable release
3
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion-prime (1.0.0)
4
+ motion-prime (1.0.1)
5
5
  activesupport
6
6
  afmotion (~> 2.1.0)
7
7
  bubble-wrap (~> 1.6.0)
@@ -20,8 +20,8 @@ GEM
20
20
  activesupport (3.2.17)
21
21
  i18n (~> 0.6, >= 0.6.4)
22
22
  multi_json (~> 1.0)
23
- afmotion (2.1.4)
24
- motion-cocoapods (~> 1.4.0)
23
+ afmotion (2.1.5)
24
+ motion-cocoapods (>= 1.4.1)
25
25
  motion-require (>= 0.1)
26
26
  bubble-wrap (1.6.0)
27
27
  bubble-wrap-http (= 1.6.0)
data/ROADMAP.md CHANGED
@@ -1,4 +1,6 @@
1
- === 1.0.0
1
+ === 1.1.0
2
+ * grid item width should be calculated based on uicollectionview with
3
+ * ability to change access token param name
2
4
  * bug: if mp label do not have text and was set as hidden, it should unhide after setting text.
3
5
  * bug: size_to_fit works incorrect with relative width.
4
6
  * bug: bind_keyboard_close breaks bind_guesture
@@ -10,12 +12,12 @@
10
12
  * add different templates. some templates should be more like final app.
11
13
  * add size_to_fit support for images.
12
14
 
13
- === 1.1.0
15
+ === 1.2.0
14
16
  * Move api_client and model sync mixin to prime_model_sync gem.
15
17
  * Move models to prime_model gem.
16
18
  * Move bind keyboard events to forms.
17
19
 
18
- === 1.2.0
20
+ === 1.3.0
19
21
  * add cell preload for reverse scrolling table.
20
22
  * add computed_options.get(), this will allow to make sure that options is computed.
21
23
  * add testing framework
data/files/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'motion-cocoapods', '~> 1.4.1'
4
- gem 'motion-prime', '1.0.0'
4
+ gem 'motion-prime', '1.0.1'
5
5
 
6
6
  # add reside menu for sidebar support
7
7
  # gem 'prime_reside_menu', '~> 0.1.4'
data/lib/motion-prime.rb CHANGED
@@ -18,7 +18,7 @@ Motion::Project::App.setup do |app|
18
18
  app.pods do
19
19
  pod 'NanoStore', '~> 2.7.7'
20
20
  pod 'SDWebImage'
21
- pod 'SVPullToRefresh'
21
+ pod 'SVPullToRefresh', git: 'git@github.com:droidlabs/SVPullToRefresh.git'
22
22
  pod 'MBAlertView'
23
23
  pod 'MBProgressHUD', '~> 0.8'
24
24
  end
@@ -1,4 +1,20 @@
1
1
  class Kernel
2
+ def benchmark(key, &block)
3
+ if Prime.env.development?
4
+ t = Time.now
5
+ result = block.call
6
+ time = Time.now - t
7
+ MotionPrime.benchmark_data[key] ||= {}
8
+ MotionPrime.benchmark_data[key][:count] ||= 0
9
+ MotionPrime.benchmark_data[key][:total] ||= 0
10
+ MotionPrime.benchmark_data[key][:count] += 1
11
+ MotionPrime.benchmark_data[key][:total] += time
12
+ result
13
+ else
14
+ block.call
15
+ end
16
+ end
17
+
2
18
  def pp(*attrs)
3
19
  NSLog([*attrs].map(&:inspect).join(' '))
4
20
  attrs
@@ -26,7 +26,7 @@ module MotionPrime
26
26
  @view_class = options[:view_class] || 'UIView'
27
27
  @name = options[:name]
28
28
  @block = options[:block]
29
- @view_name = self.class_name_without_kvo.demodulize.underscore.gsub(/(_draw)?_element/, '')
29
+ @view_name = underscore_factory(self.class_name_without_kvo.demodulize).gsub(/(_draw)?_element/, '')
30
30
 
31
31
  if Prime.env.development?
32
32
  info = []
@@ -68,7 +68,9 @@ module MotionPrime
68
68
  end
69
69
 
70
70
  def strong_references
71
- [section, (section.collection_section if section.respond_to?(:cell_section_name))].compact
71
+ refs = [section, (section.collection_section if section.respond_to?(:cell_section_name))]
72
+ refs += section.try(:strong_references)
73
+ refs.compact
72
74
  end
73
75
 
74
76
  def load_image
@@ -19,7 +19,7 @@ module MotionPrime
19
19
  view.sizeToFit
20
20
  # we should re-set values, because sizeToFit do not use padding
21
21
  view.setWidth(view.bounds.size.width + content_padding_width)
22
- view.setHeight(view.bounds.size.height + content_padding_height)
22
+ view.setHeight(computed_options[:height] || (view.bounds.size.height + content_padding_height))
23
23
  end
24
24
  end
25
25
  end
@@ -0,0 +1,23 @@
1
+ module MotionPrime
2
+ class PageViewControllerElement < BaseElement
3
+ def view_class
4
+ "UIPageViewController"
5
+ end
6
+
7
+ def render!(options = {}, &block)
8
+ builder = ViewBuilder.new(class_factory(view_class), computed_options.merge(options))
9
+ controller = builder.view
10
+ ViewStyler.new(controller, CGRectZero, builder.options).apply
11
+
12
+ first = section.collection_delegate.fetch_item(0)
13
+ controller.setViewControllers([first], direction:UIPageViewControllerNavigationDirectionForward,
14
+ animated:false, completion:lambda{|a|}) # completion:nil blows up!
15
+
16
+ screen.addChildViewController(controller)
17
+ screen.view.addSubview(controller.view)
18
+ controller.didMoveToParentViewController(screen)
19
+ screen.view.gestureRecognizers = controller.gestureRecognizers
20
+ self.view = controller
21
+ end
22
+ end
23
+ end
@@ -24,6 +24,12 @@ module MotionPrime
24
24
  Prime.camelize_factory_cache[name] = name.camelize
25
25
  end
26
26
 
27
+ def underscore_factory(name)
28
+ value = Prime.underscore_factory_cache[name]
29
+ return value if value
30
+ Prime.underscore_factory_cache[name] = name.underscore
31
+ end
32
+
27
33
  def low_camelize_factory(name)
28
34
  value = Prime.low_camelize_factory_cache[name]
29
35
  return value if value
@@ -11,6 +11,14 @@ module MotionPrime
11
11
  @low_camelize_factory_cache ||= {}
12
12
  end
13
13
 
14
+ def self.underscore_factory_cache
15
+ @underscore_factory_cache ||= {}
16
+ end
17
+
18
+ def self.benchmark_data
19
+ @benchmark_data ||= {}
20
+ end
21
+
14
22
  def self.env
15
23
  @env ||= MotionPrime::Env.new
16
24
  end
@@ -15,6 +15,10 @@ module MotionPrime
15
15
  @main_section || all_sections.first
16
16
  end
17
17
 
18
+ def main_section=(value)
19
+ @main_section = value
20
+ end
21
+
18
22
  def all_sections
19
23
  Array.wrap(@sections.try(:values))
20
24
  end
@@ -49,7 +53,11 @@ module MotionPrime
49
53
  return unless section_options
50
54
  @sections = {}
51
55
  section_options.map do |name, options|
52
- section = create_section(name, options.clone)
56
+ if options[:instance]
57
+ section = options[:instance]
58
+ else
59
+ section = create_section(name, options.clone)
60
+ end
53
61
  @sections[name] = section if section
54
62
  end
55
63
  end
@@ -92,7 +92,7 @@ module MotionPrime
92
92
  # @return [Boolean] true
93
93
  def reset_collection_data
94
94
  @did_appear = false
95
- Array.wrap(@data).each do |section|
95
+ Array.wrap(@data).flatten.each do |section|
96
96
  section.container_element.try(:update_options, reuse_identifier: nil)
97
97
  end
98
98
  @data = nil
@@ -226,6 +226,15 @@ module MotionPrime
226
226
  end
227
227
 
228
228
  def scroll_view_did_scroll(scroll)
229
+ return unless refresh_view = collection_view.try(:pullToRefreshView)
230
+ return refresh_view.alpha = 1 if refresh_view.state == SVPullToRefreshStateLoading
231
+
232
+ current_offset = scroll.contentOffset.y
233
+ table_inset = collection_view.contentInset.top
234
+ refresh_offset = refresh_view.yOrigin
235
+ alpha = [[-(current_offset + table_inset)/refresh_view.size.height, 0].max, 1].min
236
+
237
+ refresh_view.alpha = alpha
229
238
  end
230
239
 
231
240
  def scroll_view_did_end_dragging(scroll, willDecelerate: will_decelerate)
@@ -104,7 +104,7 @@ module MotionPrime
104
104
  #
105
105
  # @return name [String] section default name
106
106
  def default_name
107
- self.class_name_without_kvo.demodulize.underscore.gsub(/\_section$/, '')
107
+ underscore_factory(self.class_name_without_kvo.demodulize).gsub(/\_section$/, '')
108
108
  end
109
109
 
110
110
  # Get section elements options, where the key is element name.
@@ -0,0 +1,27 @@
1
+ motion_require './page_view/page_view_delegate'
2
+
3
+ module MotionPrime
4
+ class PageViewSection < AbstractCollectionSection
5
+ before_render :render_collection
6
+
7
+ def collection_styles_base
8
+ :base_page_view
9
+ end
10
+
11
+ def collection_delegate
12
+ @collection_delegate ||= PageViewDelegate.new(section: self)
13
+ end
14
+
15
+ def grid_element_options
16
+ collection_element_options
17
+ end
18
+
19
+ def render_collection
20
+ self.collection_element = screen.page_view_controller(grid_element_options)
21
+ end
22
+
23
+ def create_section_elements
24
+ return
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,84 @@
1
+ module MotionPrime
2
+ class PageViewDelegate
3
+ include DelegateMixin
4
+ attr_accessor :collection_section
5
+
6
+ def initialize(options)
7
+ self.collection_section = options[:section].try(:weak_ref)
8
+ @section_instance = collection_section.to_s
9
+ @view_controllers = {}
10
+ end
11
+
12
+ # def dealloc
13
+ # pp 'Deallocating page_view_delegate for ', @section_instance
14
+ # super
15
+ # end
16
+
17
+ def data
18
+ collection_section.data
19
+ end
20
+
21
+ def fetch_item(index)
22
+ if @view_controllers[index]
23
+ @view_controllers[index]
24
+ else
25
+ controller = MotionPrime::Screen.new
26
+ section = data[index]
27
+ section.screen = controller.weak_ref
28
+ controller.set_section :main, instance: section
29
+ @view_controllers[index] = controller
30
+ end
31
+ end
32
+
33
+ def viewControllerAtIndex(index, storyboard:storyboard)
34
+ return nil if data.length == 0 || index >= data.size
35
+ fetch_item(index)
36
+ end
37
+
38
+ def indexOfViewController(viewController)
39
+ @view_controllers.key(viewController)
40
+ end
41
+
42
+ def pageViewController(pvc, viewControllerBeforeViewController:vc)
43
+ index = indexOfViewController(vc)
44
+ return if !index || index <= 0
45
+ fetch_item(index - 1)
46
+ end
47
+
48
+
49
+ def pageViewController(pvc, viewControllerAfterViewController:vc)
50
+ index = indexOfViewController(vc)
51
+ return if !index || index >= data.size - 1
52
+ fetch_item(index + 1)
53
+ end
54
+
55
+ def presentationCountForPageViewController(controller)
56
+ data.size
57
+ end
58
+
59
+ def pageViewController(pvc, spineLocationForInterfaceOrientation:orientation)
60
+ page_view_controller = collection_section.collection_view
61
+ current = page_view_controller.viewControllers[0]
62
+ is_portrait = UIDevice.currentDevice.orientation == UIDeviceOrientationLandscapeLeft ||
63
+ UIDevice.currentDevice.orientation == UIDeviceOrientationPortraitUpsideDown ||
64
+ UIDevice.currentDevice.orientation == UIDeviceOrientationUnknown
65
+ if is_portrait
66
+ page_view_controller.setViewControllers([current], direction:UIPageViewControllerNavigationDirectionForward, animated:true, completion:lambda{|a|})
67
+ page_view_controller.doubleSided = false
68
+ return UIPageViewControllerSpineLocationMin
69
+ else
70
+ index = indexOfViewController(current)
71
+ if (index==0 || index%2==0)
72
+ next_vc = pageViewController(page_view_controller, viewControllerAfterViewController: current)
73
+ viewControllers = [current, next_vc]
74
+ else
75
+ prev_vc = pageViewController(page_view_controller, viewControllerBeforeViewController: current)
76
+ viewControllers = [prev_vc, current]
77
+ end
78
+ page_view_controller.setViewControllers(viewControllers, direction:UIPageViewControllerNavigationDirectionForward, animated:true, completion:lambda{|a|})
79
+ page_view_controller.doubleSided = true
80
+ return UIPageViewControllerSpineLocationMid
81
+ end
82
+ end
83
+ end
84
+ end
@@ -18,7 +18,7 @@ module MotionPrime
18
18
  element :control, type: :segmented_control,
19
19
  styles: [:base_segmented_control], items: proc { tab_control_items }
20
20
 
21
- after_render :render_tab_pages
21
+ before_render :render_tab_pages
22
22
  after_render :render_tab_controls
23
23
 
24
24
  def tab_options
@@ -6,7 +6,7 @@ module MotionPrime
6
6
  include TableSectionRefreshMixin
7
7
  include HasSearchBar
8
8
 
9
- class_attribute :group_header_options, :pull_to_refresh_block
9
+ class_attribute :group_header_options, :pull_to_refresh_block, :pull_to_refresh_options
10
10
 
11
11
  attr_accessor :group_header_sections, :group_header_options
12
12
  after_render :init_pull_to_refresh
@@ -212,6 +212,7 @@ module MotionPrime
212
212
  def cached_cell(index)
213
213
  collection_view.dequeueReusableCellWithIdentifier(cell_name(index)) || begin
214
214
  section = cell_section_by_index(index)
215
+ section.create_elements
215
216
  cell = section.try(:cell)
216
217
  if cell.try(:superview)
217
218
  Prime.logger.error "cell already exists: #{section.name}: #{cell}"
@@ -253,7 +254,8 @@ module MotionPrime
253
254
  self.group_header_options[section] = options
254
255
  end
255
256
 
256
- def pull_to_refresh(&block)
257
+ def pull_to_refresh(options = {}, &block)
258
+ self.pull_to_refresh_options = options
257
259
  self.pull_to_refresh_block = block
258
260
  end
259
261
  end
@@ -4,7 +4,17 @@ module MotionPrime
4
4
  screen.automaticallyAdjustsScrollViewInsets = false
5
5
 
6
6
  collection_view.addPullToRefreshWithActionHandler(block) # block must be a variable
7
- screen.set_options_for collection_view.pullToRefreshView, styles: [:base_pull_to_refresh]
7
+ refresh_view = collection_view.pullToRefreshView
8
+
9
+ options[:styles] ||= []
10
+ options[:styles] += [:base_pull_to_refresh]
11
+ # pass yOrigin to override view top
12
+ base_options = {
13
+ alpha: 0,
14
+ custom_offset_threshold: - collection_view.contentInset.top - refresh_view.size.height,
15
+ original_top_inset: collection_view.contentInset.top
16
+ }
17
+ screen.set_options_for refresh_view, base_options.merge(options)
8
18
  end
9
19
 
10
20
  def finish_pull_to_refresh
@@ -15,7 +15,7 @@ module MotionPrime
15
15
 
16
16
  def init_pull_to_refresh
17
17
  return unless block = table_section.class.pull_to_refresh_block
18
- table_section.add_pull_to_refresh do
18
+ table_section.add_pull_to_refresh(table_section.class.pull_to_refresh_options || {}) do
19
19
  table_section.instance_eval(&block)
20
20
  end
21
21
  end
@@ -21,7 +21,6 @@ module MotionPrime
21
21
  else # center label
22
22
  padding_top_offset = padding_top.to_i - (self.paddingBottom || self.padding).to_i
23
23
  (bounds_height - line_height)/2 + padding_top_offset
24
- # TODO: check in which cases we should add `1` here
25
24
  end
26
25
  end
27
26
 
@@ -14,7 +14,13 @@ class MPTableCellWithSection < UITableViewCell
14
14
 
15
15
  def initialize_content
16
16
  self.scroll_view = self.subviews.first
17
- self.scroll_view.subviews.first.removeFromSuperview
17
+ # iOS 8
18
+ if self.scroll_view.is_a?(UITableViewCellContentView)
19
+ self.scroll_view.removeFromSuperview
20
+ self.scroll_view = self
21
+ else
22
+ self.scroll_view.subviews.first.removeFromSuperview
23
+ end
18
24
  self.content_view = MPTableViewCellContentView.alloc.initWithFrame(self.bounds)
19
25
  self.content_view.setBackgroundColor(:clear.uicolor)
20
26
  self.content_view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
@@ -21,7 +21,7 @@ class MPTextField < UITextField
21
21
 
22
22
  # placeholder position
23
23
  def textRectForBounds(bounds)
24
- @_line_height = placeholder_font.pointSize
24
+ @_line_height = font.pointSize
25
25
  rect = calculate_rect_for(bounds)
26
26
  @_line_height = nil
27
27
  rect
@@ -36,6 +36,8 @@ class MPTextField < UITextField
36
36
  end
37
37
 
38
38
  def drawPlaceholderInRect(rect)
39
+ font_diff = self.font.pointSize - placeholder_font.pointSize
40
+ rect.origin.y += font_diff/2.0
39
41
  color = self.placeholderColor || :gray.uicolor
40
42
  color.setFill
41
43
 
@@ -1,3 +1,3 @@
1
1
  module MotionPrime
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -53,7 +53,7 @@ module MotionPrime
53
53
  [::UIActionSheet, ::UIActivityIndicatorView, ::MPButton, ::UIDatePicker, ::UIImageView, ::MPLabel,
54
54
  ::UIPageControl, ::UIPickerView, ::UIProgressView, ::UIScrollView, ::UISearchBar, ::UISegmentedControl,
55
55
  ::UISlider, ::UIStepper, ::UISwitch, ::UITabBar, ::UICollectionView, ::UITableView, ::UITableViewCell,
56
- ::MPTextField, ::MPTextView, ::UIToolbar, ::UIWebView, ::UINavigationBar,
56
+ ::MPTextField, ::MPTextView, ::UIToolbar, ::UIWebView, ::UINavigationBar, ::UIPageViewController,
57
57
  ::MPTableCellWithSection, ::MPCollectionCellWithSection, ::MBProgressHUD, ::MPSpinner].each do |klass|
58
58
 
59
59
  shorthand = "#{klass}"[2..-1].underscore.to_sym
@@ -80,6 +80,10 @@ module MotionPrime
80
80
  items = options.delete(:items) || []
81
81
  klass.alloc.initWithItems items
82
82
  },
83
+ 'UIPageViewController' => Proc.new{|klass, options|
84
+ klass.alloc.initWithTransitionStyle(UIPageViewControllerTransitionStylePageCurl,
85
+ navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal, options:nil)
86
+ },
83
87
  'UITableView' => Proc.new{|klass, options|
84
88
  style = options.delete(:style) || UITableViewStylePlain
85
89
  view = klass.alloc.initWithFrame CGRectZero, style: style
@@ -167,5 +171,11 @@ module MotionPrime
167
171
  }
168
172
  end
169
173
  end
174
+
175
+ %w[MPLabel MPTextField MPTextView MPButton].each do |default_view|
176
+ register default_view do |klass, options|
177
+ klass.alloc.initWithFrame CGRectZero
178
+ end
179
+ end
170
180
  end
171
181
  end
@@ -5,12 +5,12 @@ module MotionPrime
5
5
  include HasClassFactory
6
6
  include ElementTextMixin
7
7
 
8
- ORDER = %w[font placeholder_font text]
8
+ ORDER = %w[frame font placeholder_font text title_label title]
9
9
 
10
10
  attr_reader :view, :options
11
11
 
12
12
  def initialize(view, parent_bounds = CGRectZero, options = {})
13
- @options = Styles.extend_and_normalize_options options
13
+ @options = Styles.extend_and_normalize_options(options)
14
14
  @view = view
15
15
  prepare_frame_for(parent_bounds) if @options.delete(:calculate_frame)
16
16
  prepare_options!
@@ -39,8 +39,8 @@ module MotionPrime
39
39
  mask |= UIViewAutoresizingFlexibleLeftMargin if options[:left].nil?
40
40
  mask |= UIViewAutoresizingFlexibleBottomMargin if options[:bottom].nil?
41
41
  mask |= UIViewAutoresizingFlexibleRightMargin if options[:right].nil?
42
- mask |= UIViewAutoresizingFlexibleWidth if !options[:left].nil? && !options[:right].nil?
43
- mask |= UIViewAutoresizingFlexibleHeight if options[:height_to_fit].nil? && (!options[:top].nil? && !options[:bottom].nil?)
42
+ mask |= UIViewAutoresizingFlexibleWidth if options[:width].nil? && (!options[:left].nil? && !options[:right].nil?)
43
+ mask |= UIViewAutoresizingFlexibleHeight if options[:height].nil? && options[:height_to_fit].nil? && (!options[:top].nil? && !options[:bottom].nil?)
44
44
  options[:autoresizingMask] = mask
45
45
  end
46
46
  end
@@ -66,7 +66,11 @@ module MotionPrime
66
66
  extract_font_options(options)
67
67
  extract_font_options(options, 'placeholder')
68
68
 
69
- @options = Hash[options.sort_by { |k,v| ORDER.index(k.to_s).to_i }]
69
+ @options = Hash[
70
+ options.sort_by do |k,v|
71
+ index = ORDER.index(k.to_s) || -1
72
+ end.reverse
73
+ ]
70
74
  end
71
75
 
72
76
  def extract_font_options(options, prefix = nil)
@@ -154,10 +158,10 @@ module MotionPrime
154
158
 
155
159
  def set_text_options(key, value)
156
160
  if key == 'content_horizontal_alignment' && value.is_a?(Symbol) && %[left right center fill].include?(value.to_s)
157
- view.setValue "UIControlContentHorizontalAlignment#{value.camelize}".constantize, forKey: camelize_factory(key)
161
+ view.setValue class_factory("UIControlContentHorizontalAlignment_#{value.camelize}"), forKey: camelize_factory(key)
158
162
  true
159
163
  elsif key == 'content_vertical_alignment' && value.is_a?(Symbol) && %[top bottom center fill].include?(value.to_s)
160
- view.setValue "UIControlContentVerticalAlignment#{value.camelize}".constantize, forKey: camelize_factory(key)
164
+ view.setValue class_factory("UIControlContentVerticalAlignment_#{value.camelize}"), forKey: camelize_factory(key)
161
165
  true
162
166
  elsif key.end_with?('alignment') && value.is_a?(Symbol)
163
167
  view.setValue value.nstextalignment, forKey: camelize_factory(key)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-prime
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Haziev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-29 00:00:00.000000000 Z
12
+ date: 2014-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -282,6 +282,7 @@ files:
282
282
  - motion-prime/elements/image.rb
283
283
  - motion-prime/elements/label.rb
284
284
  - motion-prime/elements/map.rb
285
+ - motion-prime/elements/page_view_controller.rb
285
286
  - motion-prime/elements/progress_hud.rb
286
287
  - motion-prime/elements/spinner.rb
287
288
  - motion-prime/elements/table_header.rb
@@ -347,6 +348,8 @@ files:
347
348
  - motion-prime/sections/form/text_field_section.rb
348
349
  - motion-prime/sections/grid.rb
349
350
  - motion-prime/sections/header.rb
351
+ - motion-prime/sections/page_view.rb
352
+ - motion-prime/sections/page_view/page_view_delegate.rb
350
353
  - motion-prime/sections/tabbed.rb
351
354
  - motion-prime/sections/table.rb
352
355
  - motion-prime/sections/table/refresh_mixin.rb