0
IはViewController.hこのクラスプロパティのObjective Cでjsonのような構造を作成するには?
ようなビュー・コントローラ・クラスを有してい
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (nonatomic, strong) NSDictionary *dictionary;
@end
ViewController.m
#import "ViewController.h"
#import "GoogleMaps.h"
@interface ViewController()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//HOW TO ACCESS THE PROPERTY VALUE HERE
self.dictionary = @{};
/DUMP ALL FOUND ITEMS
for(DummyContainer* geoItem in geoItems) {
NSDictionary *item = @{
@"latitude":geoItem.latitude,
@"longtitude":geoItem.longtitude
};
self.dictionary[geoItem.geoPoint.name] = item;
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
予想フォーマットは
var container = {
'location':{
'latitude':1233,
'longtitude':124
}
}
でありますクラス内の辞書やアクセスなどのクラスのプロパティを作成する方法:
これは、この obj.latitude;
- のような緯度アクセスQuestion1ため
let obj = container['location'];
を経由してアクセスすることができますか?
- 質問2: JSON構造を作成して値にアクセスする方法は?
私はiOSの新機能です。事前に感謝してください。拡張/変更可能な辞書オブジェクトを作成するための非拡張/不変Dictionaryオブジェクト
@property (strong, nonatomic) NSDictionary *myClassDictionary;
を作成するための
http://www.appcoda.com/fetch-parse-json-ios-programming-チュートリアル/これは助けることができます – PrafulD
あなたはObjective-CとSwiftを混在させています。私はスイフトとスウィフトで始めることをお勧めします。 – shallowThought
目的のCコードを見つけるのを手伝ってください。私は客観的なCのみを探しています – Sundar