Today, I realise that for MVC, we can build Model and we can use our Controller. However, it seems I haven't try to design my own View but just use the default View given by IOS SDK.
Could you please consider this example case with me: to consider the tableView's Header,
1.I'd like to put a button in it
2.and make the Header much more bigger to contain some detail labels.
3.Also let the Header's background to become UIColor.blueColor()
I try to create a class(called MyHeaderView) extends form UITableViewHeaderFooterView, and I know there is one of properties inside my MyTableViewController which is the entry of the Header and I can assign a new object of my own design class object -- MyHeaderView. Am I right? That is how I thought, but I just tried the third require( change background to blue ):
inside MyHeaderView, I define a function:
class MyHeaderView: UITableViewHeaderFooterView {
func change(){
self.backgroundColor = UIColor.blackColor()
}
}
and inside
class MyTableViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
let frame = CGRectMake(0, 0, 1000, 1000)// Big enough!
var a = MyHeaderView(frame: frame)
a.change()
self.view.addSubview(a)// To be frank, I believe this statement is not right for achieving this requirement
}
}
Of course it doesn't work at all! Just like this:

Could anyone tell me a little about how to customise my own view! Thank you! (IF I my not clear myself, please help me point it out:D I will make it more detail as soon as possible)