[英]Obj-C Instance method returning a instanceType called from Swift - Function produces expected type 'UIImage!' error
[英]UIView instancetype from Obj-C at Swift
大家好,我正在接近 Swift 編程,然后馬上覺得我是 Swift 的新手
在我的 Obj-C 項目中,我創建了許多在我的應用程序中使用的UIView
類
我在從 Obj-C for Swift 實現這些類UIView
遇到了問題......
簡而言之,直到現在我一直使用這個......我的類UIView
有各種帶有框架等的初始化......但是一個直接闡述所有的實例類型
-(instancetype)initializeNotificationViewWithTitle:(NSString *)notificationTitle
notificationMessage:(NSString *)notificationMessage
notificationType:(UTNotificationType)notificationType
notificationMode:(UTNotificationMode)notificationMode
現在我不能適應 Swift 很多人肯定知道 Swift 是 Obj-C 中最簡單的,但我仍然無法適應
你能讓我了解如何實現我在 Obj-C Swift 中發布的這個功能嗎?
您提供的方法看起來像一個簡單的 init 方法,而 swift 中的 init 方法看起來像
init(title: String, message: String, type: UTNotificationType, mode: UTNotificationMode) {
//init
}
並將其用作
let aView = NotificationView(title:"title", message:"message", type: someType, mode: someMode)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.