Skip to content

Instantly share code, notes, and snippets.

@dastels
dastels / gist:6753981
Created September 29, 2013 16:23
Sample iLisp code for using abutton
(let ((w (.window *app*))
(b (UIButton/buttonWithType: UIButtonTypeSystem)))
(.frame= b '((10 100) (100 44)))
(.backgroundColor= b (UIColor/lightGrayColor))
(.setTitle:forState: b "Push Me" UIControlStateNormal)
(.setTitleColor:forState: b (UIColor/blackColor) UIControlStateNormal)
(.when b UIControlEventTouchUpInside
(lambda (sender)
(trace "click!")))
(.addSubview w b))
@dastels
dastels / gist:6743635
Created September 28, 2013 16:13
Why is initWithFrame: not working in RubyMotion. The method appears to be there on the UIView object.
Simulate ./build/iPhoneSimulator-7.0-Development/iLisp.app
(main)> v = UIView.alloc
=> #<UIView:0xc5b16d0>
(main)> v.methods.sort.select {|m| m.to_s =~ /init.*/}
=> [:init, :"initWithCoder:", :"initWithFrame:", :"initWithSize:", :"initialize_clone:", :"initialize_dup:", :selectionAffinity]
(main)> v.send("initWithFrame:", CGRectMake(10, 10, 100, 100))
dyld: lazy symbol binding failed: Symbol not found: __ZN9RoxorCore14find_bs_structESs
Referenced from: /Library/RubyMotion/data/ios/7.0/iPhoneSimulator/libmacruby-repl.dylib
Expected in: flat namespace