This is my first question.
We are developing an application to introduce a store in a certain area. There are nine buttons on the top page, separated by each category.
For example, if you press a button in the category Restaurant, a list of stores bound to the category (section) of Restaurant will appear in the table view.
So far, JSON has the data to display in the table view locally, and it worked to simply display the data list in the table view.If possible, I would like to use this JSON file as it is and implement the above functions, but would that be possible?
Also, if possible, I would appreciate it if someone could tell me what kind of coding you can think of.
*Additional JSON file example
JSON, I don't know how the array works and I can't explain it well. For example, the following is an example:
"aaa": [
{"name":"Restaurant a", "category":"restaurant", "url":"http://-----", "address":"Tokyo -----", "lat":34.000000", "lon":"135.000000000000", "tel."000" {"name":"clothes store b", "category":"fashion", "url":"http://-----", "address":"Tokyo -------", "lat":33.000000", "lon":"134.00000000", "tel":000."-pgn" >" >
"There are about 100 pieces of data lined up like this, and I would like to see a list of categories ""restaurant"" (restaurant a, b...) in the table view, and a list of categories ""fashion"" (clothes store a, b...) in the table view."
Considering the above comments,
The flow is as follows.
1. Place JSON data in NSDictionary format in NSAray (in the following example, NSDictionary is included in NSMutableArray)
NSMutableArray* allArr = NSMutableArray array; arr=[@[@{@"name":@"Restaurant a", @"category":@"restaurant"}, @{@"name":@"Restaurant b", @"category":@"restaurant"}, @{@"name":@"Restaurant c", @"category":@"restaurant"}, @{@"name":@"Sports Center a", @"category":@"sports", @{@"name":@"Sports Center b", @"category":@"sports"}]mutableCopy];
NSMutableArray* restaurantArr = [NSMutableArray array]; for (NSDictionary*dic in allArr) { if([dic[@"category"]isEqualToString:@"restaurant"){ [restaurantArrdObject:dic]; } }
RestaurantArr now includes Category: Restaurant Dictionary.
© 2024 OneMinuteCode. All rights reserved.