UIButton没有出现在Rubymotion中

时间:2013-11-23 19:48:39

标签: rubymotion

出于某种原因,我的UIButton没有出现在我的红宝石动作应用程序中。仅显示按钮文本。

以下是代码:

@containerView = UIView.alloc.initWithFrame([[0, 50], [self.view.frame.size.width, 100]])

@loginButton = UIButton.buttonWithType(UIButtonTypeRoundedRect)
@loginButton.frame = [[(self.view.frame.size.width  / 2) + 5, 65], [(self.view.frame.size.width  / 2) - 15, 40]]
@loginButton.setTitle('Login', forState: UIControlStateNormal)
@loginButton.addTarget(self,
                       action:'login',
                       forControlEvents:UIControlEventTouchUpInside)

@containerView.addSubview(@loginButton)
self.view.addSubview(@containerView)

我正在使用RubyMotion v2.16,Promotion 1.0.4,sugarcube 1.3.5,运动布局0.0.1和bubblewrap 1.4.0

我尝试使用促销方式,sugarcube方式和bubblewrap方式渲染按钮,但决定将其分解为原始rubymotion方式(上图),以便在常规视图控制器中进行故障排除。关于这个的任何想法?

1 个答案:

答案 0 :(得分:3)

好吧,如果其他人也在阅读过时的文档,那么事实证明UIButtonTypeRoundedRect在iOS7中已被弃用。

https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/Controls.html#//apple_ref/doc/uid/TP40013174-CH9-SW1