nsmutablearray

How can I show several location points on map in objective c

三世轮回 提交于 2019-12-13 02:59:29
问题 I have two NSMutableArray, first keeps some location's latitudes and second keeps longitudes. Then, I want to see this locations on map with markers. I try like this but it is not work. How can I do this? for (int x=0; x<=[ws8.Latitude count]; x++) { for (int y=0; y<=[ws8.Longitude count]; y++) { CLLocationCoordinate2D location1; location1.latitude = [[ws8.Latitude objectAtIndex:x] floatValue]; location1.longitude = [[ws8.Longitude objectAtIndex:y] floatValue]; region.span=span; region.center

Performance issues with NSMutableArray and NSArray

荒凉一梦 提交于 2019-12-13 02:14:21
问题 I've been programming C/C++ for 20 years but I'm new to objective-c and Coco and have some questions about the performance of NSMutableArray and NSArray. I need an container much like the stl list container, but coco doesn't seem to have one and inserting and removing elements from the middle of MSMutableArray seems slow, but treating it like a stl vector isn't that fast either. Also, MSMutableArray seems to only store Objects, so keep tracking of a simple data type line int or float incurs

addObjectsFromArray: not copying into global NSMutableArray

青春壹個敷衍的年華 提交于 2019-12-13 02:03:22
问题 So here is a partial sample of the relevant code. static NSMutableArray *radioInputArray; static NSMutableArray *buttonsArray; - (IBAction)lookForRadioButtons:(id)sender { // NSLog(@"Testing"); NSError *error; NSString *radiostr = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"getRadios" ofType:@"txt"] encoding:NSASCIIStringEncoding error: &error] ; if (radiostr == nil) { NSLog (@"Error! %@", error); } else { NSLog(@"%@",radiostr); NSString *radiotxt= [webView

Cannot convert value of type 'NSMutableArray' to expected argument type '[SKAction]'

佐手、 提交于 2019-12-13 01:37:57
问题 I checked my old game (made in SpriteKit) and I want to update it in Swift 2.0. When I tried to fix it, Xcode found an errors. Error is: Cannot convert value of type 'NSMutableArray' to expected argument type '[SKAction]' In code: torpedo.runAction(SKAction.sequence(actionArray)) Function: override func touchesEnded(touches: Set<UITouch>, withEvent event: UIEvent?) { self.runAction(SKAction.playSoundFileNamed("torpedo.mp3", waitForCompletion: false)) var touch:UITouch = touches.anyObject() as

NSMutableArray is not storing data properly into the loop

那年仲夏 提交于 2019-12-12 18:32:37
问题 I try to store some NSMutableDictionaries into an NSMutableArray throw a for loop: NSMutableArray *productsIdAndQuantities = [[NSMutableArray alloc]init]; NSMutableDictionary *element = [[NSMutableDictionary alloc]init]; for (id object in shoppingArray) { [element setObject:[object valueForKey:@"proId"] forKey:@"id"]; [element setObject:[object valueForKey:@"qty"] forKey:@"quantity"]; NSLog(@"%@",element);//tested, it's different on every iteration [productsIdAndQuantities addObject:element];

How to remove all objects with the same property value but one in NSMutableArray

有些话、适合烂在心里 提交于 2019-12-12 13:15:58
问题 I have a history object with a url string property and title. I want to search all the history for objects with the url containing a search string, then remove all duplicates. Example: I have an array of history objects and 20 of them are all "https://www.google.com" and 4 are "https://www.google.com/#q=search", I want to get an array back with only one object with the url value of "https://www.google.com" and one url value of "https://www.google.com/#q=search" Here is my current code that

-[UIImage length]: unrecognized selector sent to instance error with a NSMutableArray with Images

扶醉桌前 提交于 2019-12-12 11:34:31
问题 I have a storyboard app which has a UIViewController and a UICollectionViewController . In the view controller, the user chooses multiple photos from the iPhone's photo library (Since there is no API for multi-select in iOS, I used ELCImagePickerController to achieve this). And it segues to the collection view controller where the selected photos should be shown in little image views. The image library shows up and I am able to select multiple photos. But when it segues to the collection view

Why can you sometimes cast a NSArray to NSMutableArray, and sometimes you can't?

时光总嘲笑我的痴心妄想 提交于 2019-12-12 10:59:27
问题 Specifically: self.words = (NSMutableArray*)[self.text componentsSeparatedByString:@" "]; works fine so long as there are separators. I see that the method returns the original string wrapped in an NSArray if there isn't, though. This single element NSArray stubbornly refuses to be cast as an NSMutableArray. But, when I do: self.words = [NSMutableArray arrayWithArray:self.words]; It works just fine. Is there something I'm missing here? Is it bad practice to cast from NSArray to NSMutableArray

Searching for a value in an unknown NSMutableArray depth

删除回忆录丶 提交于 2019-12-12 09:42:52
问题 Ok, i kind of asked the wrong question so I've edited the original question. I'm storing Arrays within Arrays, as well as NSDictionaries. It's a utility kind of application and there is no set structure, the user can enter nested information as much as they require. Ideally I need a method to scroll through the entire contents of my array given a set parameter (a type of class, maybe a dictionary key). Here's an example.. NSMutableArray *array = [[NSMutableArray alloc]init];

Comparing NSMutableArray Elements for Values

℡╲_俬逩灬. 提交于 2019-12-12 09:08:53
问题 I am looking for a way to compare the contents of two NSMutableArray objects. Both arrays are filled with NSMutableDictionaries which were allocated separately but occasionally contain the same data. Simplified Example: NSMutableArray *firstArray = [[NSMutableArray alloc] init]; NSMutableArray *secondArray = [[NSMutableArray alloc] init]; NSMutableDictionary *a = [[NSDictionary alloc] init]; [a setObject:@"foo" forKey:"name"]; [a setObject:[NSNumber numberWithInt:1] forKey:"number"];