翻转图像以便在按钮上使用

时间:2016-02-24 14:49:45

标签: ios swift uikit

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

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

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

1 个答案:

答案 0 :(得分:0)

你可以试试这个:

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

在此处查看他们如何设置动画:https://gist.github.com/bergholdt/0db2d2264e29e3646e9c