It is shown that initWithFrame is deprecated with initWithStyle in sdk3.0 and above.
But we can still use it without any warning/error. So is it ok to continue using initWithFrame for implementing custom cell in tableview?
Thank You.
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.
It is, in principle, ok. But it doesn’t really make sense for new code to do this. The frame you pass to
initWithFramedoesn’t really influence the cell anyway, which means you should just callinitWithStyle:UITableViewCellStyleDefault, which has the same result asinitWithFrame:CGRectZero.In existing code, it is of course ok for some time to keep using
initWithFrame, but when you get the chance, you should change it toinitWithStyle. At some (unknown) point in the future, Apple will stop supporting the deprecated method, and your app won’t build with new iPhone OS releases if it uses old methods.