views:

655

answers:

2

Hi,

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.

A: 

For a few more OS releases it is OK. Like many deprecated methods and those in the Mac OS X sdk, it takes Apple some time (years?) to actually stop supporting them.

mahboudz
Ok, I got it.. it seems they have deprecated but still not leave off support for old one, but they may do that after some release.Thank You.
Jay Vachhani
+3  A: 

It is, in principle, ok. But it doesn't really make sense for new code to do this. The frame you pass to initWithFrame doesn't really influence the cell anyway, which means you should just call initWithStyle:UITableViewCellStyleDefault, which has the same result as initWithFrame: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 to initWithStyle. 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.

mrueg
ya I got it, in this way we can also do the same as we have to change in tableviewcell's init function also.Thank you.
Jay Vachhani