nsmutablearray

Line Graph CGPoints from NSMutableArray

白昼怎懂夜的黑 提交于 2019-12-11 21:17:45
问题 I have been trying to adapt the code from the accelerometer example such that when the user depresses a uibutton a point is added to a line graph. Working on the converting two floats, which are the result of calculate as below into a CGPoint and converting the CGPoint into an NSValue and then adding this to a NSMutableArray with the following -(IBAction)calculate:(id)sender { self.points = [NSMutableArray array]; CGPoint pt = CGPointMake(d, c); [self.points addObject:[NSValue

componentsJoinedByString gives me EXC_BAD_ACCESS

≯℡__Kan透↙ 提交于 2019-12-11 20:38:57
问题 I have an NSMutableArray i am trying to convert into a string. Declaring my NSMutableArray... NSMutableArray *listData; And later inside a method... NSString *foo = [listData componentsJoinedByString:@"|"]; NSLog(@"%@",foo); It seems no matter what i try i keep getting EXC_BAD_ACCESS. To make sure each element in my array was an NSString i also tried this... NSMutableArray *mArray = [[NSMutableArray alloc] init]; for (id ln in listData) { NSString *boo = [NSString stringWithFormat: @"%@",ln];

NSMutableArray within NSString

那年仲夏 提交于 2019-12-11 20:35:05
问题 After 10 years without programming (in Delphi at the time), I began learning Objective-C. I confess I have met lots of problems as this approach is very different. I want to make a simple table in which each line consists of several NSString variables. An example: ID Firstname Lastname 01 FN1 LN1 02 FN2 LN2 My table: NSString * FirstName, * LastName; NSMutableArray * person = [NSMutableArray arrayWithObjects: firtsname, lastname, nil]; The problem is that I can not add a line with the 2

How to compare and merge NSMutableArray

空扰寡人 提交于 2019-12-11 19:18:43
问题 I have 2 NSMutableArrays that contains an instances of the class Person. I need to check is there any Person with same value of "name" in both of arrays and merge it with ask about replace instances of Reson with same value "name". It looks like: empl1 = [ Person [ name = @"Paul", age = 45, ], Person [ name = @"John", age = 36, ] ] empl2 = [ Person [ name = @"Paul", age = 47, ], Person [ name = @"Sean", age = 30, ] ] Then program ask about replacement Person @"Paul" in empl1 with Person @

iPhone plist add new string to array

一曲冷凌霜 提交于 2019-12-11 18:47:36
问题 I am populating a picker with values from a plist file. the format of plist is as below. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>type</key> <array> <string>AAAA</string> <string>BBBBB</string> <string>CCCCC</string> </array> </dict> </plist> In project calling this dictionary/array to a Picker, this works fine. NSBundle *bundle = [NSBundle mainBundle];

How add values from text field / label to an array when a button click in iphone

空扰寡人 提交于 2019-12-11 17:45:11
问题 I have a text field In that user can enter values from 1-10 at the bottom of the text field i have button. i need to add the values in text filed to array when user clicks done button for this i wrote code like this. - (void)viewDidLoad { [super viewDidLoad]; PainlevelsArray = [[NSMutableArray alloc] init]; //PainlevelsArray declared in .h } -(IBAction)doneClick:(id)sender { [PainlevelsArray addObject:txtField.text ]; // [PainlevelsArray insertObject:rateLabel.text atIndex:0 ]; NSLog(@

Can't remove all objects in NSMutableArray

余生长醉 提交于 2019-12-11 17:04:13
问题 For some reason, I keep getting this error when I run my app: [__NSArrayI removeAllObjects]: unrecognized selector sent to instance I set up the NSMutableArray in .m like this: @implementation ChooseViewController { NSMutableArray *trackName; } And populate it like this: trackName = [JSON valueForKeyPath:@"results.trackName"]; But when I run this code, it gives me the error: [trackName removeAllObjects]; Everything else works fine and the data in trackName works. It's just messing up when I

How to do XML Parsing in Swift3 iOS?

喜你入骨 提交于 2019-12-11 16:59:59
问题 I am trying to do XML Parsing of below file : <bgmusic> <genre title=“Title1”> <track title=“SubTitle1” path="https://test/Background_Track%20-%20Ambient%20-%20ANW2856_01_ Animation.ogg" /> <track title="SubTitle2” path="https://test/Background_Track%20-%20Ambient%20-%20ANW2860_02_Entanglement.ogg" /> </genre> <genre title="Title2”> <track title="SubTitle3” path="https://test/Background_Track%20-%20Ambient%20-%20ANW2856_01_Animate.ogg" /> <track title="SubTitle4” path="https://test/Background

Using an NSMutableArray instead of an NSFetchedResultsController

人盡茶涼 提交于 2019-12-11 16:08:48
问题 I've recently come to learn that NSFetchedResultsController is an extremely buggy class and its been causing me headaches for a while now with my rather large Core Data app. Would it be appropriate to use an NSMutableArray to feed the table view instead of an NSFetchedResultsController ? What I'm talking about is, temporarily creating a fetched results controller to grab the objects from my managed object context, creating a new NSMutableArray with the fetchedObjects from the fetched results

iPhone SDK: Download and Set UIImageView before first view controller is displayed

爱⌒轻易说出口 提交于 2019-12-11 15:25:31
问题 I am having trouble getting a UIImage to display instantly after the app has finished loading and displays the first view controller. There is a delay in the displaying of the image due to it being downloaded from the web. Is there any method that gets called before applicationDidFnishLaunching so the image can be downloaded and displayed instantly ? Here is the code that I am using to download the images: In delegate, this method is called in appDidFinishLaunching: -(void)downloadImages {