【问题标题】:Flip image for usage on button翻转图像以在按钮上使用
【发布时间】:2016-02-24 14:49:45
【问题描述】:

我的应用中有一些按钮声明如下:

let infoButton = UIButton(type: UIButtonType.InfoLight) as UIButton
infoButton.addTarget(self, action: "toggleInfo", forControlEvents: UIControlEvents.TouchUpInside)
self.navigationItem.rightBarButtonItem  = UIBarButtonItem(customView: infoButton)

在将图像分配给我的 NavigationBar 之前,有没有办法从系统定义的按钮本身(例如垂直)镜像图像?

【问题讨论】:

  • 我不这么认为。我想翻转一个内置的图形 - 这里是一个系统类型按钮。
  • 您可能想尝试下载模板 PSD 并为自己导出所需的按钮。例如来自:dribbble.com/shots/…

标签: ios swift uikit


【解决方案1】:

你可以试试这个:

    CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI * 0.05);
    UIView *view = [buttonItem valueForKey:@"view"];
    view.transform = transform;

在这里查看他们是如何制作动画的:https://gist.github.com/bergholdt/0db2d2264e29e3646e9c

【讨论】:

    猜你喜欢
    • 2017-01-15
    • 1970-01-01
    • 2021-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-02
    • 2010-10-23
    相关资源
    最近更新 更多