plist

iPhone Dev - Edit objects in Array from Plist

我是研究僧i 提交于 2019-11-28 11:54:56
问题 I have a Plist in which I have a number of Array's. Within these arrays are different objects that I'm reading, I've become stuck however on editing these objects in the array and then saving the array back to the Plist file again. I'm already reading the file like so... Array = [myArrays objectAtIndex:arrayCounter]; //This tells it which Array to load. myObject = [Array objectAtIndex:0]; //This reads that object in the array. (This is what I want to edit.) I was wondering how I would go

How to Save NSMutableArray into plist in iphone

≯℡__Kan透↙ 提交于 2019-11-28 11:32:28
I am new in iphone, i want to save NSMutableArray data into plist file my Code is: NSArray *array = [[NSArray alloc] initWithArray:self.artistDetailsArray]; [self.artistDetailsArray writeToFile:self.path atomically:YES]; but it shows 0 element in my plist path. please any help me. Thanks in advance: following is my code to store the data into plist and NSUserDefault. none of them is working for NSMutableArray/NSArray but working for NSString. IS there any max size limit to store in plist or UserDefault?? NSMutableArray contains only text/ set of NSDictionary. please suggest me. - (void

Add Item to Finder Sidebar

流过昼夜 提交于 2019-11-28 11:26:44
I would like to add a new item to the Finder sidebar. I found out that the Finder keeps the list of "places" in `~/Library/Preferences/com.apple.sidebarlists.plist. I was able to read the file using Carbon API and saw that each item had Name, icon and alias. Using a 3rd party application such as PlistEdit Pro I was able to update the alias. My question is how to update the alias using Carbon API. Was not able to find a way to create alias that will open in Finder. It seem that both Dropbox and PlistEditor Pro was able to find the way. Asmus Take a look here : The Shared File List API is new to

How to populate UITableView with plist

为君一笑 提交于 2019-11-28 10:47:45
问题 I have a simple UITableView that I'd like to populate using a plist file. I have followed a few tutorials but they all seem to over complicate the process and in the end I end up getting errors or my app simply does not work. I'm using a window based application. Cheers, Sam 回答1: To load the file : thearray = [NSArray arrayWithContentsOfFile:thePath]; Then you need to set your controller as the data source and delegate for the table view and implement at least : - (NSInteger

Not able to write to Plist

给你一囗甜甜゛ 提交于 2019-11-28 10:28:09
问题 I have a very basic question about how to write to a plist. I added a "Here.plist" file to my resources folder. The following is my code: NSString *path = [[NSBundle mainBundle]pathForResource:@"Here" ofType:@"plist"]; NSArray *array = [[NSArray alloc]initWithObjects:@"First", @"Second", @"Third", nil]; [array writeToFile:path atomically:YES]; "Here.plist" is still empty after executing the code. I even tried using a NSDictionary as follows: NSDictionary *dict = [[NSDictionary alloc

Updating and saving data in plist

▼魔方 西西 提交于 2019-11-28 10:23:48
I am making an iOS game and need to save the highest level the player has reached. I can successfully change a data element in a plist, but for some reason, that data keeps reverting to its original value every time the game restarts. Here is the basic flow of my code: In the game's init, get the highest level the player has reached (the original value is 1) pData = [[PlayerData alloc] init]; currentLevel = [[pData.data valueForKey:@"Highest Level"] intValue]; [self startNewLevel:currentLevel]; 'data' is an NSMutableDictionary that gets initialized like this in PlayerData: self.data =

A question on how to Get data from plist & how should it be layout

血红的双手。 提交于 2019-11-28 10:23:08
问题 This is a follow up question on my first queries regarding retrieving data on plist. Right now i have manage to detect users touches made on my view with random image call out (thanks to phytonquick). CGPoint currentTouchLocation = [currentTouch locationInView:self]; Im having trouble now on how to compare the value i got from the users touches made on the random image in the view to the one save inside the plist data with the same name as the random image the users touches. I know how to

How to print a string from plist without “Optional”?

北慕城南 提交于 2019-11-28 09:46:56
I load a value from a dictionary in a plist but when I print it to the console, it prints: Optional(Monday Title) rather than just "Monday Title". How can I get rid of the Optional() of my value when printing? var plistPath = NSBundle.mainBundle().pathForResource("days", ofType: "plist") var plistArray = NSArray(contentsOfFile: plistPath!) as NSArray! for obj: AnyObject in plistArray { if var dicInfo = obj as? NSDictionary { let todayTitle: AnyObject? = dicInfo.valueForKey("Title") println(todayTitle) } } One way to get rid of the Optional is to use an exclamation point: println(todayTitle!)

How can we create our own plist file in a Xcode project?

随声附和 提交于 2019-11-28 07:53:15
I want to create "UrlPaths.plist" file in my Application and also a dictionary with 4 or 5 objects. Please help me create a plist file and dictionary. And also read data from that plist file. I want the plist to add the file to resources folder and i want to add Dictionary at that time also.i dont want pragmatical creation of plist but i want reading the data is pragmatically. Aravindhan NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory

iPhone - Change app icon pointed to by info.plist within the application?

梦想的初衷 提交于 2019-11-28 07:52:54
问题 Is there any way to change the 47x47 PNG, pointed to within info.plist, for the iPhone springboard icon from within code? I understand I can add a translation and change the springboard icon per language that the iPhone supports via a changed info.plist per language, but I would like to change the springboard icon for my iPhone app based on a user preference within the app. Any ideas? I haven't tried this, but can a file be copied over another within an app bundle? Could I ship with info