Class: UIView

Inherits:
Object
  • Object
show all
Includes:
PurplishFrame::CocoaTouchView
Defined in:
lib/purplish-frame/ui/ios/ui_view.rb

Instance Method Summary collapse

Methods included from PurplishFrame::CocoaTouchView

#bottom, #top

Methods included from PurplishFrame::View

#center_x, #center_x=, #center_y, #center_y=, #height, #inset!, #left, #left=, #right, #right=, #size_height_to_fit, #size_height_to_fit_align_bottom, #size_height_to_fit_max, #size_height_to_fit_min, #size_width_to_fit, #size_width_to_fit_align_right, #size_width_to_fit_max, #size_width_to_fit_min, #width, #width=

Instance Method Details

#bottom=(bottom) ⇒ Object



14
15
16
17
18
# File 'lib/purplish-frame/ui/ios/ui_view.rb', line 14

def bottom=(bottom)
  f = frame
  f.origin.y = bottom - f.size.height
  self.frame = f
end

#height=(height) ⇒ Object



20
21
22
23
24
# File 'lib/purplish-frame/ui/ios/ui_view.rb', line 20

def height=(height)
  f = frame
  f.size.height = height
  self.frame = f
end

#move_origin_relative_to_superview(v) ⇒ Object



42
43
44
45
46
# File 'lib/purplish-frame/ui/ios/ui_view.rb', line 42

def move_origin_relative_to_superview(v)
  pt = origin_relative_to_superview(v)
  self.left = pt.x
  self.top = pt.y
end

#origin_relative_to_superview(v) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/purplish-frame/ui/ios/ui_view.rb', line 26

def origin_relative_to_superview(v)
  sup = superview
  offset = CGPointZero

  #if ([sup isKindOfClass:[UIScrollView class]]) {
    #offset = ((UIScrollView*)sup).contentOffset
  #}

  if !sup || v == sup
    return CGPoint.new(left-offset.x, top-offset.y)
  else
    d = sup.origin_relative_to_superview(v)
    return CGPoint.new(left+d.x-offset.x, top+d.y-offset.y)
  end
end

#top=(y) ⇒ Object



8
9
10
11
12
# File 'lib/purplish-frame/ui/ios/ui_view.rb', line 8

def top=(y)
  f = frame
  f.origin.y = y
  self.frame = f
end

#view_frameObject



4
5
6
# File 'lib/purplish-frame/ui/ios/ui_view.rb', line 4

def view_frame
  frame
end