Class: UIView

Inherits:
Object
  • Object
show all
Includes:
Teacup::Layout, Teacup::View
Defined in:
lib/teacup-ios/core_extensions/ui_view.rb

Overview

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.

Instance Attribute Summary

Attributes included from Teacup::View

#debug, #style_classes, #stylename, #teacup_next_responder

Instance Method Summary collapse

Methods included from Teacup::View

#_teacup_check_stylename, #add_style_class, #add_uniq_constraints, #animate_to_style, #animate_to_stylename, #animate_to_styles, #apply_constraints, #apply_style_properties, #apply_stylename, #get_ns_constraints, #remove_style_class, #reset_constraints, #restyle!, #stylesheet, #stylesheet=, #teacup_subviews, #viewWithStylename, #viewsWithStylename

Methods included from Teacup::Layout

#auto, included, #layout, #stylesheet, #stylesheet=, #subview

Instance Method Details

#style(properties) ⇒ Object



19
20
21
22
23
24
# File 'lib/teacup-ios/core_extensions/ui_view.rb', line 19

def style(properties)
  super

  self.setNeedsDisplay
  self.setNeedsLayout
end

#teacup_animation(options) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/teacup-ios/core_extensions/ui_view.rb', line 10

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

#top_level_viewObject



26
27
28
# File 'lib/teacup-ios/core_extensions/ui_view.rb', line 26

def top_level_view
  self
end