相关疑难解决方法(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万
查看次数

标签栏图标大小

苹果

根据设备和方向,系统会显示常规或紧凑的标签栏。您的应用应包含两种尺寸的自定义标签栏图标。

不幸的是,他们未能指定您何时获得哪个。

此外,我可能会包含两种尺寸的图像,但系统会自动在它们之间切换(如何?)还是我必须自己做?

uitabbarcontroller uikit uitabbaritem ios

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