nsarray

Error spliting NSarray into sections

萝らか妹 提交于 2019-12-13 22:15:42
问题 Okay so I have been working through an example that closely matches what I am trying to achive, the sole difference being that in the example he is directly calling from his database the data he needs to be sectioned etc. Where as I already have a sorted NSArray. This is the tutorial I am working off - iPhone Development: Creating Native Contacts like screen I have created a Method that is capturing each entry in the NSArray and putting these results into a alpha based NSDictionary (so their

Parse a Json Table to a NSMutableArray [duplicate]

与世无争的帅哥 提交于 2019-12-13 22:08:14
问题 This question already has an answer here : Parsing Json to get all the contents in one NSArray (1 answer) Closed 5 years ago . for the moment I fill in my array directly by a native objective-C code : Datas *pan1 = [[Datas alloc] initWithTitle:@"My array 1" title:@"Shakespeare's Book" location:@"London"]; Datas *pan2 = [[Datas alloc] initWithTitle:@"My array 2" title:@"Moliere's Book" location:@"London"]; NSMutableArray *datasListe = [NSMutableArray arrayWithObjects:pan1, pan2, nil]; But I

Array out of bounds and slow slow app

允我心安 提交于 2019-12-13 21:21:50
问题 So below is my code for my controller, which I have four of one for each tab on the tab bar. I have two issues. I am getting an array out bounds but I can't chase it down. Am I missing something here? Second when my app starts up it take 5 - 8 seconds before it loads the first view of the tab bar. Once it loads and I click another tab, the tab doesn't turn blue and the app sits there for 3 seconds then finally switches. I am a noob and am struggling here. I think this issue might be fixed by

How to get the contents of an array to display on a uitextfield

浪尽此生 提交于 2019-12-13 20:36:42
问题 I'm trying to get the contents of an array to display on a uitextfield. here's my code: NSArray *arrayConditions = [[NSArray alloc] initWithObjects:[item objectForKey:@"conditions"], nil]; NSString * resultConditions = [arrayConditions description]; // conditionsDeal is the uitextfield self.conditionsDeal.text = resultConditions; conditions are being pulled from a url like this: "results": [ { "conditions": [ "Il coupon è valido per soggiorni fino al...", "I coupon sono cumulabili,

UIPickerView Using NSDictionary

人盡茶涼 提交于 2019-12-13 18:24:44
问题 I am new to Swift Programming Language. I am trying to make a UIPickerView which work like select or listbox that contain key,value.If user select one from picker view,it gives me the key of that value. I have been browsing for almost half of the day trying to figure this out. All i got was UIPickerView using array results.All i want to know was how to store a Dictionary[key:value] in UIPickerView and if user select one of the value from picker,how to get the key. Please Help. With Regards 来源

Plugging a sortedArrayUsingSelector and/or initWithArray Memory Leak Between Classes

*爱你&永不变心* 提交于 2019-12-13 17:22:29
问题 I've been struggling to solve this memory leak for awhile now, so I'm hoping the community can provide some help. Memory Management is still an issue I'm working to understand (and yes I have the memory management guide). According to the Instruments Leak tool, I'm leaking an NSArray as soon as I navigate backward (back button w/ Nav Controller) off of the pertinent screen. I'm show all the relevant code I can think of, below, and can share more if needed. I know that I'm alloc/initing an

How do I easily strip just a comma from an NSString?

爷,独闯天下 提交于 2019-12-13 17:11:43
问题 I have a UILabel with the following text: Medium, Black What I intended to do was grab the words in the string and insert each into a mutable array so I could use each title later on to identify something. Here's how I done this: NSMutableArray *chosenOptions = [[[[cell tapToEditLabel] text] componentsSeparatedByString: @" "] mutableCopy]; NSString *size = [chosenOptions objectAtIndex:0]; NSString *colour = [chosenOptions objectAtIndex:1]; I've logged these two NSString and size is returning

Efficiently create placeholder template NSString with NSArray of values

喜欢而已 提交于 2019-12-13 16:12:14
问题 I am trying to make a utility method for FMDB which will take an NSArray of values and return a string of placeholders for use in an IN statement based on the number of values in the array. I can't think of an elegant way of creating this string, am I missing some NSString utility method: // The contents of the input aren't important. NSArray *input = @[@(55), @(33), @(12)]; // Seems clumsy way to do things: NSInteger size = [input count]; NSMutableArray *placeholderArray = [[NSMutableArray

How do I select a random key from an NSDictionary?

一笑奈何 提交于 2019-12-13 12:29:39
问题 When I was using an NSArray, it was easy: NSArray *array = ... lastIndex = INT_MAX; ... int randomIndex; do { randomIndex = RANDOM_INT(0, [array count] - 1); } while (randomIndex == lastIndex); NSLog(@"%@", [array objectAtIndex:randomIndex]); lastIndex = randomIndex; I need to keep track of the lastIndex because I want the feeling of randomness. That is, I don't want to get the same element twice in a row. So it shouldn't be "true" randomness. From what I can tell, NSDictionary doesn't have

Incompatible pointer types initializing 'NSMutableArray *' with an expression of type 'NSArray *' [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 11:29:37
问题 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 6 years ago . This is my code that is causing the above warning: NSMutableArray *tbValueArray = [NSArray arrayWithObjects:oServices1.text, oServices2.text,oServices3.text,oServices4.text,oServices5.text,oServices6.text, oServices7.text,oServices8.text,oServices9.text,oServices10.text,oServices11.text, oServices12.text