nsmutablearray

NSMutable Array from One Class to Another Class in iPhone

时光总嘲笑我的痴心妄想 提交于 2020-01-17 08:06:09
问题 I have an NSMutable Array in FirstViewController class, I want to Pass that array to SecondViewController class. And I want to use that in SecondViewController class. I am doing this in Xcode 4.2.1 with ARC... How can I...? and what are the attributes i want to use when setting property... (OR) Explain me using Appdelegate files also... 回答1: There are two ways to do this. 1: Make a property for NSMutableArray in appdelegate, set the value for array in FirstViewController and retrieve value in

iOS Swift How to check Key Availability in NSMutableArray

陌路散爱 提交于 2020-01-17 06:43:52
问题 I am having some set of NSMutableArray like: ( { name = "ILTB"; source = "iltb.net"; }, { name = "Baran Bench"; source = "baranbench.com"; }, { name = "Income Tax India 1"; source = "Income Tax India 1"; } ) How to check Key availability in this NSMutableArray. For Example I need to check "ILTB" is already in my MutableArray or not. 回答1: First of all ILTB is not key but its value for key name . You probably want search from array. Now in Swift instead of NSArray use Swift's native array of

addObject for NSMutableArray crashes!

北慕城南 提交于 2020-01-16 12:34:07
问题 I am dealing with a problem which is driving me mad. I have looked at other forums and my code seems to be ok, however it fails when invoking addObject method for NSMutableArray. I am implementing a simple xml parser class and storing some of the information in a NSMutableArray: - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ if([elementName isEqualToString:@"Image"]){ [images setObject: [

addObject for NSMutableArray crashes!

假装没事ソ 提交于 2020-01-16 12:34:03
问题 I am dealing with a problem which is driving me mad. I have looked at other forums and my code seems to be ok, however it fails when invoking addObject method for NSMutableArray. I am implementing a simple xml parser class and storing some of the information in a NSMutableArray: - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName{ if([elementName isEqualToString:@"Image"]){ [images setObject: [

Does Nssortdescriptor convert contents of the array to integer after sorting?

情到浓时终转凉″ 提交于 2020-01-16 09:08:36
问题 Given the below code, in the first iteration the logs are displayed normally. For the second iteration the app crashes with the following error message: 019-11-07 09:54:08.156277+0100 xxxion[520:202084] iconNumberString : 1026 2019-11-07 09:54:12.160849+0100 xxxtion[520:202084] [self.iconNumbers lastObject]) : 1026 2019-11-07 09:54:24.598805+0100 xxxion[520:202084] -[__NSSingleObjectArrayI addObject:]: unrecognized selector sent to instance 0x2824a3fd0 (lldb) The nssortdescriptor used:

Dictionary or Array

孤人 提交于 2020-01-16 04:42:20
问题 In what situation does it make sense to use a dictionary versus a NSMutableArray? 回答1: Those are 2 different types of containers. Array is a sequential data storage where you can retrieve elements by index. Dictionary is a hash where you retrieve elements by "names". Both have pros and cons (lookup speed, insertion time, enumeration, etc). Please read on generic Array vs Hash. 回答2: Depends on your requirements. If you need a collection of stuff, any order or even strictly ordered, and you

Dictionary or Array

折月煮酒 提交于 2020-01-16 04:42:08
问题 In what situation does it make sense to use a dictionary versus a NSMutableArray? 回答1: Those are 2 different types of containers. Array is a sequential data storage where you can retrieve elements by index. Dictionary is a hash where you retrieve elements by "names". Both have pros and cons (lookup speed, insertion time, enumeration, etc). Please read on generic Array vs Hash. 回答2: Depends on your requirements. If you need a collection of stuff, any order or even strictly ordered, and you

c++ mutable array of various data types?

让人想犯罪 __ 提交于 2020-01-16 01:05:17
问题 I decided one day to create a class in c++ with storage capabilities similar to that of NSMutableArray in objective c (I know vectors are the goto data type for this sort of thing but I made my own anyway). So I made a mutableArray class in c++, and so far it works great. I can add and remove objects, insert them to a specific index if I want, all without having to specify the size of my array. So my problem is: so far, it can only store objects of type int. Is there any way I can make it so

Delete Specific Items from NSMutableArray

北战南征 提交于 2020-01-15 09:15:19
问题 I'm trying to perform the relatively simple task of deleting the items in an NSMutableArray that fit a certain criteria. In this particular case, I'd like to delete the items where all of the following are true: city: Seattle state: WA timestamp: more than 60 seconds old An NSLog of my array looks like this: array = ( { city = "Seattle"; state = "WA"; timestamp = 1432844384; }, { city = "Dallas"; state ="TX"; timestamp = 1432844415; }, { city = "Seattle"; state = "WA"; timestamp = 1432845329;

How to add NSMutableArray as objectAtIndex for NSMutableArray

孤人 提交于 2020-01-14 06:40:10
问题 How to add NSMutableArray as an object(i) for another NSMutableArray My code is: yearImages = [[NSMutableArray alloc]init]; tempImages = [[NSMutableArray alloc]init]; for(int i =0; i< [yearImagesName count]; i++) { for(int j=0; j<[totalImagesName count]; j++) { if ([[totalImagesName objectAtIndex:j] rangeOfString:[yearImagesName objectAtIndex:i]].location != NSNotFound) { [tempImages addObject:[totalImagesName objectAtIndex:j]]; } } [yearImages addObject:tempImages]; [tempImages