Class: Debugmotion::Console

Inherits:
UIView
  • Object
show all
Defined in:
lib/debugmotion/console.rb

Instance Method Summary collapse

Instance Method Details

#append(text) ⇒ Object



18
19
20
21
# File 'lib/debugmotion/console.rb', line 18

def append(text)
  @text_view.text = "#{@text_view.text} \n #{text}"
  @text_view.scrollRangeToVisible([@text_view.text.length - 1, 1])
end

#initWithFrame(frame) ⇒ Object



5
6
7
8
9
10
# File 'lib/debugmotion/console.rb', line 5

def initWithFrame(frame)
  super
  self.backgroundColor = UIColor.darkGrayColor
  UIApplication.sharedApplication.keyWindow.addSubview(self)
  self
end

#layoutSubviewsObject



12
13
14
15
16
# File 'lib/debugmotion/console.rb', line 12

def layoutSubviews
  @text_view = text_view
  @move_label = move_label
  [@move_label, @text_view].each {|v| self.addSubview(v)}
end

#touchesMoved(touches, withEvent: event) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/debugmotion/console.rb', line 23

def touchesMoved(touches, withEvent:event)
  touch = touches.anyObject
  previous_location = touch.previousLocationInView(self.superview)
  current_location = touch.locationInView(self.superview)
  center = self.center
  center.x += current_location.x - previous_location.x
  center.y += current_location.y - previous_location.y
  self.center = center
end