override initとsuper.initの使い方がわからなくつまずいています。
目的としては、UITextCustomViewにフレームと表示する文章を渡して、mainViewControllerに表示させたいです。
宜しくお願いします。
mainViewController.swift
lang
1var section:String = "文章" 2self.view.addSubview(UITextCustomView(frame: self.view.frame ,section: section))
UITextCustomView.swift
lang
1 2import UIKit 3 4class UITextCustomView: UIView { 5 6 override init(frame: CGRect, section: String) { 7 super.init(frame: frame , section: section) 8 let tv = UITextView(frame: CGRectMake(0, 0, self.frame.width-30, 300)) 9 self.addSubview(tv) 10 11 // 文字 12 tv.text = section 13 14 } 15 16 required init(coder aDecoder: NSCoder) { 17 fatalError("init(coder:) has not been implemented") 18 } 19 20}

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。