【问题标题】:create ios7 button on prior versions在早期版本上创建 ios7 按钮
【发布时间】:2014-01-06 07:39:18
【问题描述】:

是否可以在 ios 的早期版本上创建 button 以使其类似于 ios 7 中的一个?我希望我的 button 仅显示文本,而不是在选中时显示为白色矩形或蓝色。

【问题讨论】:

  • 试试UIButtonTypeCustom
  • 您需要在早期版本的 iOS 中使用 iOS 7 按钮的图像。检查 iOS 版本并用图像替换现有按钮,以防不是 iOS 7。

标签: ios iphone objective-c ipad uibutton


【解决方案1】:

如果您使用的是界面生成器,那么只需将一个按钮拖到视图中,然后在属性检查器中选择自定义类型,然后在占位符中添加所需的文本。 否则,如果您以编程方式创建按钮,那么

UIButton *buttonName = [UIButton buttonWithType:UIButtonTypeCustom];
[buttonName setTitle:@"Some Text" forState:UIControlStateNormal];

【讨论】:

    【解决方案2】:

    试试这个...

    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [btn setTitle:@"text" forState:UIControlStateNormal]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-07-24
      • 1970-01-01
      • 2015-12-12
      • 1970-01-01
      • 2013-10-01
      • 1970-01-01
      • 2010-11-02
      相关资源
      最近更新 更多