nsmutablearray

Ordered Arrays with Firebase

拥有回忆 提交于 2019-12-24 17:44:08
问题 As Firebase doesn't guarantee order when reading from a base, we can get unordered output from this async call: -(void)loadDataFromFirebase { handles = [[NSMutableArray alloc] init]; Firebase* listRef = [[Firebase alloc] initWithUrl:@"https://mobilefeast.firebaseIO.com/foodtrucks"]; [listRef observeEventType:FEventTypeChildAdded withBlock:^(FDataSnapshot *snapshot) { NSLog(@"%@", snapshot.name); [handles addObject:snapshot.value]; [self.handleTableView reloadData]; }]; } In the example

Sending NSMutableArray OR NSDictionary to php to mysql [closed]

霸气de小男生 提交于 2019-12-24 15:13:00
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . In my application, i made an activity to get input numbers from the user, the number of textfields for input data is different each time, it's a tableView and each cell has a textfield, i managed to store all the numbers in a NSMutableArray , and I've been looking into how to pass it to my php, I can't seem to

Store NSMutable Array into sqlite database

雨燕双飞 提交于 2019-12-24 09:37:24
问题 hi i am writng an iphone app and need a bit of help.. i have this uitableview which displays data that is contained in a nsmutable array.. this data is retrieved via some operations therefore amount of data is not the same every time... what i want to know is if i had something like: NSMutableArray *mArray; how would i go about storing and loading the 'mArray' from an sqlite database.. Further info as requested: @Caleb @westsider Array Contents: The contents of the array are simple module

images from an array

假如想象 提交于 2019-12-24 09:26:19
问题 i create an nsmutableArray and i add for it an images. also i create an imageView that i want to show the images from the array, i tried to use animationImages but i nothing is happened, how can i fix it? here is my code: //Numbers images UIImage *numberZero = [UIImage imageNamed:@"numberZero.png"]; UIImage *numberOne = [UIImage imageNamed:@"numberOne.png"]; UIImage *numberTwo = [UIImage imageNamed:@"numberTwo.png"]; UIImage *numberThree = [UIImage imageNamed:@"numberThree.png"]; UIImage

Singleton NSMutableArray accessed by NSArrayController in multiple NIB's

泄露秘密 提交于 2019-12-24 08:24:45
问题 Early warning - code sample a little long... I have a singleton NSMutableArray that can be accessed from anywhere within my application. I want to be able to reference the NSMutableArray from multiple NIB files but bind to UI elements via NSArrayController objects. Initial creation is not a problem. I can reference the singleton NSMutableArray when the NIB gets loaded and everything appears fine. However, changing the NSMutableArray by adding or removing objects does not kick off KVO to

How should {array|dictionary}WithCapacity be used? [duplicate]

允我心安 提交于 2019-12-24 07:18:56
问题 This question already has answers here : NSMutableArray initWithCapacity nuances (2 answers) Closed 5 years ago . When I use NSMutableArray or NSMutableDictionary , if I know the number of elements I want to put in or the max number of elements, I usually create them with arrayWithCapacity or dictionaryWithCapacity , but I wonder does it really help to specify an (initial) capacity for the array/dictionary? I don't know how it is implemented internally, but I believe it is possible that when

NSArrayM length : unrecognized selector sent to instance

杀马特。学长 韩版系。学妹 提交于 2019-12-24 03:04:24
问题 Before I get roasted let me say that I have looked at almost all the answers to "unrecognized selector sent to instance" and tried some of the suggestions but nothing seems to work. So here is my question. I call my function CreateAboutData in the viewDidLoad function. -(void)createAboutData { NSMutableArray *aboutText; aboutSections = [[NSMutableArray alloc] initWithObjects:@"About", nil]; aboutText = [[NSMutableArray alloc] init]; //Set About Info [aboutText addObject:[[NSMutableDictionary

creating a Mutable array that can be added to in later clicks of the same button?

a 夏天 提交于 2019-12-23 12:37:45
问题 General noob questions: (1) How can I create an NSMutable array in a buttonClicked action that I can add more entries to during subsequent clicks of the same button? I always seem to start over with a new array at every click (the array prints with only 1 entry which is the most recent button's tag in an NSLog statement). I have about 100 buttons (one for each character in my string called "list") generated by a for-loop earlier in my code, and each has been assigned a tag. They are in a

NSMutableArray addObject, unrecognized selector

送分小仙女□ 提交于 2019-12-23 11:52:52
问题 I'm trying to create an array (States) of arrays (Cities). Whenever I try to add an item to my City array I get this error: 'NSInvalidArgumentException', reason: '*** +[NSMutableArray addObject:]: unrecognized selector sent to class 0x303097a0 My code is as follows. The line it errors on is [currentCities addObject:city]; I'm sure I've got some Memory Management problem as I still don't understand it all that well. Was hoping someone could explain my mistake to me. if (sqlite3_prepare_v2(db,

How to cast a swift array of tuples to NSMutableArray?

只谈情不闲聊 提交于 2019-12-23 09:43:37
问题 I have swift array of tuples [(String, String)] and would like to cast this array to NSMutableArray. I have tried this and it is not working: let myNSMUtableArray = swiftArrayOfTuples as! AnyObject as! NSMutableArray 回答1: Since swift types like Tuple or Struct have no equivalent in Objective-C they can not be cast to or referenced as AnyObject which NSArray and NSMutableArray constrain their element types to. The next best thing if you must return an NSMutableArray from a swift Array of