How to read or write data from a .plist file in Xamarin.ios

  • Need to fetch data from plist file
  • Need to display data in UITableView in Xamarin.iOS
+3


source to share


1 answer


It's pretty trivial to read with plist.

Make sure the build action of the plist file is "Asset Bundle".

Then you can read the content of the plist if it is a dictionary:

var dict = NSDictionary.FromFile (path);

      

Or is this an array:



NSArray array = NSArray.FromFile(path);

      

From NSArray you can populate the UITableView.

I would suggest you check out the tutorial on the Xamarin website for populating the UITableView, its very clear and concise.

[1] http://developer.xamarin.com/guides/ios/user_interface/tables/part_2_-_populating_a_table_with_data/

Edited to read from a dictionary, per @ jstedfast's advice in a comment

+4


source







All Articles