【发布时间】:2015-01-14 03:05:18
【问题描述】:
如何将这种 Objective-C 格式转换为 Swift?我已经创建了一个名为 Bridging-Header.h 的桥接头。
我已经将这个库头导入到桥接头中。
#import "DraggableView.h"
#import "DraggableViewBackground.h"
#import "OverlayView.h"
那我想把这个Objective-C的东西转成swift。
DraggableViewBackground *draggableBackground = [[DraggableViewBackground alloc]initWithFrame:self.view.frame];
[self.view addSubview:draggableBackground];
到目前为止我已经做了什么,我在我的ViewController.swift 中从DraggableViewBackground.h 调用对象DraggableViewBackground。
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
var instanceOfDraggableViewBackground: DraggableViewBackground = DraggableViewBackground()
}
}
【问题讨论】:
标签: ios objective-c swift xcode6 bridging-header