ARC下的stringWithFormat与initWithFormat [英] stringWithFormat vs initWithFormat under ARC

查看:102
本文介绍了ARC下的stringWithFormat与initWithFormat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

stringWithFormat:NSString的类方法,并返回自动释放的字符串; initWithFormat:是一个实例方法,在ARC之前,程序员必须照顾返回对象的内存管理.如果打开了ARC,这两种方法有什么区别?

stringWithFormat: is a class method of NSString, and returns an autoreleased string; initWithFormat: is an instance method, and before ARC the programmer had to take care of the returned object's memory management. If we have ARC turned on, what is the difference between the two methods?

推荐答案

使用ARC,这两种方法是等效的.

With ARC, these two methods are equivalent.

请参阅:

这篇关于ARC下的stringWithFormat与initWithFormat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆