Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 等同于swift中的UIButtonTyperoundRect?_Ios_Swift_Uibutton_Uikit - Fatal编程技术网

Ios 等同于swift中的UIButtonTyperoundRect?

Ios 等同于swift中的UIButtonTyperoundRect?,ios,swift,uibutton,uikit,Ios,Swift,Uibutton,Uikit,当我尝试在swift中使用UIButtonType时,UIButtonTypeUndeDrect不再存在: Swift中是否有一个等价的类,或者我是否需要创建一个新的子类以获得相同的外观?您需要使用uibuttonypesystem 只需使用一个简单的按钮,然后走自己的路: let button = UIButton() button.layer.cornerRadius = 3.0 button.clipsToBounds = true 它不在Xcode 6.4中包含的SDK中: enu

当我尝试在swift中使用
UIButtonType
时,UIButtonTypeUndeDrect不再存在:


Swift中是否有一个等价的类,或者我是否需要创建一个新的子类以获得相同的外观?

您需要使用
uibuttonypesystem


只需使用一个简单的按钮,然后走自己的路:

let button = UIButton()
button.layer.cornerRadius = 3.0
button.clipsToBounds = true

它不在Xcode 6.4中包含的SDK中:

enum UIButtonType : Int {

    case Custom // no button type
    @availability(iOS, introduced=7.0)
    case System // standard system button

    case DetailDisclosure
    case InfoLight
    case InfoDark
    case ContactAdd
}
但在Xcode 7中包含的SDK中,它又回来了,并被标记为已弃用

enum UIButtonType : Int {

    case Custom // no button type
    @available(iOS 7.0, *)
    case System // standard system button

    case DetailDisclosure
    case InfoLight
    case InfoDark
    case ContactAdd

    static var RoundedRect: UIButtonType { get } // Deprecated, use UIButtonTypeSystem instead
}

您应该使用
系统
。如果它不符合您的需要,请不要子类化
UIButton
,使用自定义工厂方法。

我无法想象这实际上是特定于Swift的。我敢肯定,iOS7中的按钮类型已经被弃用了。是的,先生,事实证明它不是特定于Swift的,我只是在应用程序的Swift迁移过程中偶然发现了它#帽尖