Can I use viewDidLoad method in UITableviewCell?
Can I use viewDidLoad method in UITableviewCell ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No you don’t write viewDidLoad in Custom cell class subclassing UITableViewCell(It;s part of UIViewController) .you have a method called
where in you can define frames and all for custom cell’s controls.Refer Apple’s UITableviewCell reference
Note however that ‘viewDidLoad’ is called only once in the lifetime of the object; it is rather like an initializer in general OO programming. However, ‘layoutSubviews’ will be called many times on each cell (depending on issues like scrolling and so on). It’s important to realize that for this reson many of the things you "usually do" in viewDidLoad, you can not do in layoutSubviews.
Note that viewDidLoad is called once only: layoutSubviews is called often.
It will just be a simple function if you write it.
Tutorial for custom cell