takuma104 / iphone-rubycocoa

Ruby / RubyCocoa for the iPhone SDK

This URL has Read+Write access

iphone-rubycocoa / main.rb
100644 35 lines (25 sloc) 0.877 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
require 'rubycocoa'
 
# require 'remote_irb'
# RemoteIRB.new(6000).start
 
class MyAppDelegate < OSX::NSObject
 
attr_accessor :window
attr_accessor :textView
 
def initialize
p self
end
 
def applicationDidFinishLaunching(application)
@window = OSX::UIWindow.alloc.initWithFrame(OSX::UIScreen.mainScreen.bounds)
@window.setBackgroundColor(OSX::UIColor.darkGrayColor)
@window.makeKeyAndVisible
 
@textView = OSX::UILabel.alloc.initWithFrame(OSX::UIScreen.mainScreen.bounds)
@textView.setText("hello RubyCocoa world")
@textView.setTextAlignment(OSX::UITextAlignmentCenter)
@textView.setFont(OSX::UIFont.boldSystemFontOfSize(24))
@textView.setTextColor(OSX::UIColor.whiteColor)
@textView.setBackgroundColor(OSX::UIColor.clearColor)
 
@window.addSubview(@textView)
 
p @window
p @textView
end
end
 
OSX.UIApplicationMain(0, nil, nil, "MyAppDelegate")