Sha256: 36cf7b62e88c33d92343f7748ff5e89be8ad2e9ee6c15aabc5d0ab453d8406cd

Contents?: true

Size: 752 Bytes

Versions: 28

Compression:

Stored size: 752 Bytes

Contents

# Teacup's UIView extensions defines some utility functions for UIView that
# enable a lot of the magic for Teacup::Layout.
#
# Users of teacup should be able to ignore the contents of this file for
# the most part.
class UIView
  include Teacup::Layout
  include Teacup::View

  def teacup_animation(options)
    UIView.beginAnimations(nil, context: nil)
    UIView.setAnimationDuration(options[:duration]) if options.key?(:duration)
    UIView.setAnimationCurve(options[:curve]) if options.key?(:curve)
    UIView.setAnimationDelay(options[:delay]) if options.key?(:delay)
    yield
    UIView.commitAnimations
  end

  def style(properties)
    super

    self.setNeedsDisplay
    self.setNeedsLayout
  end

  def top_level_view
    self
  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
teacup-2.1.1 lib/teacup-ios/core_extensions/ui_view.rb
teacup-2.1.0 lib/teacup-ios/core_extensions/ui_view.rb
teacup-2.0.6 lib/teacup-ios/core_extensions/ui_view.rb
teacup-2.0.5 lib/teacup-ios/core_extensions/ui_view.rb
teacup-2.0.4 lib/teacup-ios/core_extensions/ui_view.rb
teacup-2.0.3 lib/teacup-ios/core_extensions/ui_view.rb
teacup-2.0.2 lib/teacup-ios/core_extensions/ui_view.rb
teacup-2.0.0 lib/teacup-ios/core_extensions/ui_view.rb