Su AppDelegate de RubyMotion necesita un acceso @window

He visto mucho código para AppDelegateclases en RubyMotion que se parece mucho a esto: class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @window.rootViewController = UIViewController.new // … @window.makeKeyAndVisible true endend …

Leer más

Imagen teñida de RubyMotion con CGBlendMode

Inspirado en http://robots.thoughtbot.com/designing-for-ios-blending-modes . class UIImage def tintedImageWithColor(tintColor) UIGraphicsBeginImageContext(self.size) tintColor.setFill bounds = [[0, 0], self.size] UIRectFill(bounds) self.drawInRect(bounds, blendMode: KCGBlendModeHardLight, alpha: 0.8) tintedImage = UIImage.UIGraphicsGetImageFromCurrentImageContext UIImage.UIGraphicsEndImageContext tintedImage endend Entonces úsalo así: …

Leer más

Use Teacup para su diseño

Tu vida no será mucho más fácil ni más hermosa que esto: Teacup::Stylesheet.new :main_screen do style :create_button, left: 29, height: 45, image: UIImage.imageNamed(‘ui-btn-create.png’), top: 100, width: 291end

Leer más

Color de fondo del botón Atrás en Rubymotion

En UIViewController: back_button_background = UIImage.imageNamed(“back_btn.jpg”).resizableImageWithCapInsets([0, 14, 0, 6])back_button = UIBarButtonItem.appearance.setBackButtonBackgroundImage(back_button_background, forState: UIControlStateNormal, barMetrics: UIBarMetricsDefault)self.navigationItem.backBarButtonItem = back_button

Leer más

Cambiar la transición entre UIViewControllers

Dentro de un UIViewController transition = CATransition.animationtransition.timingFunction = CAMediaTimingFunction.functionWithName( KCAMediaTimingFunctionEaseIn)transition.duration = 0.25transition.type = KCATransitionMoveIn #Push Revealtransition.subtype = KCATransitionFromRightself.navigationController.view.layer.removeAllAnimationsself.navigationController.view.layer.addAnimation(transition, forKey:KCATransition) vc=UIViewController.alloc.init self.navigationController.pushViewController(vc, animated:false) Tipos kCATransitionFadekCATransitionMoveInkCATransitionPushkCATransitionReveal [ http://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CATransition_Class/Introduction/Introduction.html#//apple_ref/doc/constant_group/Common_Transition_Types ] Subtipos kCATransitionFromRightkCATransitionFromLeftkCATransitionFromTopkCATransitionFromBottom [ …

Leer más