相关疑难解决方法(0)

使标签栏上的自定义按钮四舍五入

这是我想要做的: 在此输入图像描述

注意:屏幕截图取自早期版本的iOS

我能够实现的目标: 在此输入图像描述

码:

 override func viewWillAppear(animated: Bool) {
    // Creates image of the Button
    let imageCameraButton: UIImage! = UIImage(named: "cameraIcon")

    // Creates a Button
    let cameraButton = UIButton(type: .Custom)
    // Sets width and height to the Button
    cameraButton.frame = CGRectMake(0.0, 0.0, imageCameraButton.size.width, imageCameraButton.size.height);
    // Sets image to the Button
    cameraButton.setBackgroundImage(imageCameraButton, forState: .Normal)
    // Sets the center of the Button to the center of the TabBar
    cameraButton.center = self.tabBar.center
    // Sets an action to the Button
    cameraButton.addTarget(self, action: "doSomething", forControlEvents: …
Run Code Online (Sandbox Code Playgroud)

uibutton uitabbar ios swift

20
推荐指数
3
解决办法
2万
查看次数

标签 统计

ios ×1

swift ×1

uibutton ×1

uitabbar ×1