Ios 等同于swift中的UIButtonTyperoundRect?
当我尝试在swift中使用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
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迁移过程中偶然发现了它#帽尖