TT按钮未显示
我使用以下代码在我的 loadView 方法中添加 TTButton:
TTButton* button2 = [TTButton buttonWithStyle:@"forwardActionButton:" title:@"Login"];
[button2 setFrame:CGRectMake(245, 160, 65, 33)];
[self.view addSubview:button2];
但按钮没有出现。
你知道我在这里缺少什么吗? (我在头文件中做了#import)
谢谢,
I use the following code to add TTButton in my loadView method:
TTButton* button2 = [TTButton buttonWithStyle:@"forwardActionButton:" title:@"Login"];
[button2 setFrame:CGRectMake(245, 160, 65, 33)];
[self.view addSubview:button2];
But the button does not appear.
Do you know what am I missing here? (I did #import in my header file)
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这段代码看起来不错。您在哪里声明“forwardActionButton”样式?据我所知,这不是一个现有的 Three20 TTStyle。任何自定义样式都应该位于样式表类中,并且应该加载到应用程序委托中,如下所示:
您还可以使用现有的 TTStyle 进行尝试,例如“toolbarForwardButton:”,看看是否有效。
以下是使用 TTButton 并将功能选择器设置为按钮目标的工作示例:
This code snippet looks fine. Where are you declaring the "forwardActionButton" style? It's not a three20 existing TTStyle as far as I know. Any custom styles should be in a style sheet class and should be loaded in the app delegate, as such:
You can also try it with an existing TTStyle, such as "toolbarForwardButton:" and see if that's works.
Here's a working example on using TTButton and setting a function selector as the button's target: