I am from android background and I just started working on iPhone
I want to perform this operation in iPhone as I do in Android.
ArrayList<String> aa = new ArrayList<String>();
public void fillArray(String s)
{
aa.add(s);
}
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.
As Binyamin Sharet suggest you have to use
NSMutableArray. This class allows you to create a dynamic array. You can perform addition or deletion. On the contraryNSArrayis a immutable version of it. You cannot add or delete objects to aNSArrayonce created.The same distinction can be applied to
NSDictionaryandNSMutableDictionary(and other).Here a simple example.
An important aspect of
NSMutableArray(the same could be applied to other class) is the memory management one. When you add an object to aNSMutableArrayit retains objects added to it. So, if you NOT use ARC you have to deal with this aspect.For further info I suggest you to read about NSMutableArray class reference.
Hope it helps.