Static string variable in Objective C on iphone
Posted
by Prajakta
on Stack Overflow
See other posts from Stack Overflow
or by Prajakta
Published on 2009-06-11T09:03:27Z
Indexed on
2010/04/24
10:23 UTC
Read the original article
Hit count: 357
Hi,
How to create & access static string in iPhone (objective c)?
I declare static NSString *str = @"OldValue"
in class A.
If i assign some value to this in class B as str = @"NewValue"
.
This value persists for all methods in class B. But if I access it in class C (after assignment in B) I am getting it as OldValue.
Am I missing something? Should i use extern in other classes?
Thanks & Regards, Yogini
© Stack Overflow or respective owner