As I know, I can use global variable transfer the value among the multi viewcontrollers of a project.
But I hope to know the best way to transfer NSString variables between multi viewcontrollers and the way to avoid memory leak.
Welcome any comment
Thanks
interdev
The best way to pass parameters between your view controllers is to use properties. If applicable, have your app delegate set the initial value in your root view controller. Then you set the property before you push a new view controller on your navigation stack, or raise a new view controller modally. e.g.:
When passing
NSStringobjects, you will normally want to usecopyinstead ofretainwhen declaring the property. (See this previous SO question for more detail.) e.g.:Avoid leaking memory by releasing the property in the view controller’s
deallocmethod, e.g.: