Questions for nsarray


sorting an NSArray of NSDates

I have an NSArray of NSDate objects and I want to sort them so that today is at 0, yesterday at 1 etc.

Is it ok to re-sort an array each time you need to access an element at a specific index?

I have a TableViewController that displays a list of elements CoreData relationship. In my cellForRowAtIndexPath:, I am getting a sortedArray from the set and then accessing the element at indexPat...

Filter and NSDictionary of NSArray of NSDictionary's

I have an NSDictionary which contains some 150 keys of boiler manufacturers. The value for each key is an NSArray of an NSDictionary. Each NSDictionary represents a boiler with some properties:

NSArray -initWithObjects: does not store objects

I'm getting a really bizarre output from that contructor. It does not actually store any of the objects. I debugged the method and the objects being stored are initialized properly.

Edit plist in objective c

I have a plist file and i want edit this file, but setObject() in NSDictionary dont operate, my code is:

Filter NSArray of custom objects

I have a NSArray of Contact objects, we can call it contacts. Contact is a superclass, FacebookGroup and Individual are subclasses of Contact. FacebookGroup has a property called individuals which...

How to add objects to IBOutletCollection?

I declared NSArray in my class

key values from an NSDictionary formatting with “()”

I'm trying to pull two values from this Dictionary, But the values I'm getting have "()" around them. Any Ideas what is causing this?

removeObjectsAtIndexes causing a crash

Can't figure out whats causing the crash here. Im enumerating over a NSMutableArray and placing the indexes of certain objects into a mutable index set, then attempting to remove the corresponding

How do I get the startDate of an event that is already on my iPhone's calendar?

I am making an app for myself and I need to access the startDate and endDate of specific events that are already in my calendar. How can I go about doing this? I have tried storing a list of events...

Objective C - Subclassing NSArray

I am trying to subclass NSArray, but it crashes the app when trying to access the count method. I know that NSArray is a class cluster.

Search NSArray of NSDictionaries

I have an array with dictionaries,

how do I sort the result of @distinctUnionOfObjects?

I am using the following code to get my unique order types:

What is the BOOL *stop argument for enumerateObjectsUsingBlock: used for?

I've been using enumerateObjectsUsingBlock: a lot lately for my fast-enumeration needs, and I'm having a hard time understanding the usage of BOOL *stop in the enumeration block.

NSMutablearray move object from index to index

I have a UItableview with reordable rows and the data is in an NSarray. So how do I move an object in the NSMutablearray when the appropriate tableview delegate is called?

NSArray removeObjectAtIndex Error

I am using the following code to check whether an object exists or not before removing it if it does:

iOS: get 3 different random elements from an NSMutableArray

I have a NSMutableArray of N Integer elements (N>4), I want to get 3 different random elements from this array. I do not really need a perfectly-uniform distribution, just 3 different random elements

saving array to disk in a singleton

I have a singleton which has an NSArray that is created when the first instance of the singleton is. When should I save this array to disk, in dealloc method? I checked the Apple docs and its says...

Store App names in NSArray from JSON DATA which Stored in NSDictionary

I have retrive following response form Server in JSON format which I have sucessfully store in NSDictionary.

IOS get object from NSArray

I am developing an IOS application. How can I get the object from NSArray list. What is the best way to avoid getting memory error? Can you tell me the correct method? Thanks

Filtering NSArray string elements

So, basically I have an NSArray.

Assign string values to a NSArray - iOS

I have an iOS app which downloads/parses strings from a JSON file. I need to store these strings in ONE NSArray. But every time I try I get the error:

Dynamically create NSString from NSArray - NSXMLParser

I have a class that implements methods from NSXMLParser and parses an XML document. Since class will be used to parse several xml documents, the keys passed into my class will change.

Split String into Array Objects

I am getting response from web-service like this

Delete or clear ALL data objects in UITableView with alert button?

OK, I really have searched through the topics that seem to cover this but still have not found one that works for me. This list is made by sending every UIWebView page load here. At some point if the

NSArray: Why is SIGABRT sent instead of an 'index out of bounds' kind of error?

Ok. So I had this extremely weird SIGABRT error on a complex Objective-C iOS program that I'm working on, and after one day of tracking I found the culprit.

Performing valueForKeyPaths against multiple keyPaths

Let's say I have an object with some number of properties and I load up 1000s of these objects into an array. Next, I perform a series of valueForKeyPaths against these properties:

Get all the objects inside an NSArray whose string property starts with a particular letter

I have an NSArray containing instances of MyCustomObject; each has a NSString called firstName.

Saving addressbookUI data to an array

I'm trying to save the kABFirstNamePropert, kABLastNameProperty and kABAddressProperty all saved into an array for recall later, I'm just not getting it, can anyone lend me a hand or point me in the

NSArray sort and isolate

I have an NSArray of names, I want to sort them alphabetically into a UITableView and separate them into sections.

How do I check if an object exists at a certain index of an NSMutableArray?

For instance, how could I verify if there is an item at the index 3?

removing one object from nsarray removes all

I have an nsarray of distinct nsmutablearray's called: playerSkillsByLevelSnapshots. At the beginning of the code below the array contains 6 objects.

initWithArray vs initWithArray copyItems

I have a question what's the difference between these two methods on initializing an array?

Compare every object of an array with every other object

I am trying to crate an if statement like this:

How to Fix EXC_BAD_ACCESS on NSArray Property?

This is yet another EXC_BAD_ACCESS question. Although I've done my homework and am certain that I am not over-releasing my NSArray.

my xmlDictionary its allway (null)

im trying to get the same value on xmlDictionary and dicionarioXML but, my dicionarioXML its allway (null), any help?

Is there a way to get an easy overview of an NSArray?

I'm getting an NSArray filled with something from a helper class. I have a small clue that it might contain NSDictionarys. But i'm not sure. I tried to save the array to a plist but it didn't work

Sorting Array of Objects by Date into TableView

I used this answer to sort 2 objects by date, and it worked perfectly: Get one NSArray

re-populating a tableview with new array elements when a cell is clicked in swift

thanks for all the help so far. I need, when a cell in UITableView is clicked, to re-populate the view with an array read from another class - just can find a way to refresh the view. Code as follo...

IOS - Add subview to certain UICollectionView Cells only

This is the flow of my app: I have UICollectionview with thumbnails of images. User selects images and taps on Save button. Images get saved to camera roll.

Objective C, iOS, how do I attach a couple of int variables to UIImageView which is part of an IBOutletCollection?

I need to keep track of some image views which can be dragged around the screen and located within other images views. For example footballs in goals. I'd like to do this by having some extra prope...

how can i create plist like below in image?

Iam trying to create a plist with following feature.

Implementation of NSArray

How is a NSArray implemented, is it similar to std::vector.

data from txt file to NSArray

What I would like to do is the following:

What is the most elegant way to get a subarray from a NSArray?

In Python I can get a subarray easily like this

How would I convert an NSMutableArray filled of UNIX dates to standard dates?

I have an NSMutableArray filled up of UNIX dates (1305410327), and I want to convert all of them to readable dates like Fri, 06 Feb 2009 07:28:06 +0000. I'm so lost and this is the code I have:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.