使用Floaty库显示矩形按钮

问题描述 投票:0回答:1

我正在使用Floaty库(This one)的浮动按钮。它确实显示浮动按钮也是如此

enter image description here

但我希望浮动按钮看起来像这样......

enter image description here

这里标题为'Contribute'的黄色按钮是我想要的Floaty

ios swift floating-action-button
1个回答
0
投票

在这里,您需要为Floaty设置两个属性

floaty.buttonImage = UIImage(named: "yourimage") //this will set your image
floaty.paddingX = self.view.frame.width/2 - floaty.frame.width/2 //this will set it to center.

当你点击这个按钮时还有旋转,所以你需要去Floaty类,然后搜索下面的行并对其进行评论。

self.plusLayer.transform = CATransform3DMakeRotation(self.degreesToRadians(self.rotationDegrees), 0.0, 0.0, 1.0)
self.buttonImageView.transform = CGAffineTransform(rotationAngle: self.degreesToRadians(self.rotationDegrees))

self.plusLayer.transform = CATransform3DMakeRotation(self.degreesToRadians(0), 0.0, 0.0, 1.0)
self.buttonImageView.transform = CGAffineTransform(rotationAngle: self.degreesToRadians(0))
© www.soinside.com 2019 - 2024. All rights reserved.