2016-07-12 5 views
-2

以下のレスポンスでは、バリデーションルールの配列を取得する必要があります。私は、別のviewcontrollerのtableviewでvalidationRulesからフィールド名を表示する必要があります。テーブルビューに行を挿入する

(
{ 
    accountPurpose = 4; 
    accountType = Savings; 
    bankUserId = Jjhhhhj; 
    bankerCode = "BASSEIN CATHOLIC CO-OP BANK (Band)"; 
    createdTimeStamp = "<null>"; 
    creditCardExpiry = "<null>"; 
    creditCardNumber = "<null>"; 
    customerAccountType =   (
        { 
      description = "<null>"; 
      id = 0; 
      name = "<null>"; 
     } 
    ); 
    debitCardExpiry = "<null>"; 
    debitCardNumber = "<null>"; 
    defaultAccount = 0; 
    enabled = true; 
    id = 940; 
    mmid = 2323223; 
    phoneNumber = 9177509924; 
    serverId = 940; 
    updatedTimeStamp = "<null>"; 
    validationRules =   (
        { 
      fieldDataType = String; 
      fieldDisplayName = MPIN; 
      fieldName = mpin; 
      fieldStatus = No; 
      id = 58; 
      maxFieldLength = 6; 
      minFieldLength = 4; 
     } 
    ); 
} 

) 

私を助けてください。

+1

入れてくださいあなたが試したコード。 –

答えて

0

これは、セルのテキストフィールドに必要な文字列を取得するのに役立ちます。ここで使用したvalidationRulesArrayのような検証ルールを格納するためのグローバル配列を作成します。

let aDictionary = resultArray!.firstItem as! NSDictionary 
self.validationRulesArray = aDictionary.objectForKey("validationRules") as! NSArray 

を次のようにあなたのJSONを取得した後、あなたが表示するための別のビューにこのvalidationRulesArrayを渡すことができvalidationRules列を抽出します。 cellForIndexPathデリゲートメソッドでは、次のように記述して文字列を取得します。

let validationDictionary = self.validationRulesArray[indexPath.row] as! NSDictionary  
cell.textLabel.text = validationDictionary.objectForKey("fieldName") as! String 
0

あなたのWebサービスの応答後、すべての重要なデータの辞書の配列を取得します。

Webサービスの応答でそう
let validationRulesArray = NSMutableArray() 

..

for resultDictionary in resultArray{ 
    validationRulesArray.addObject(resultDictionary.objectForKey("validationRules") as NSDictionary) 
} 

そして、あなたは別のビューに、この配列を渡すcontroller..Andテーブルビューで表示するには、その配列データを使用することができます。..

関連する問題