小编Tha*_*vel的帖子

XML转换为iOS中的JSON转换

我需要将XML响应转换为JSON.

我的XML响应:

<commands>
<command id="0" name="GetAPPsProducts">
  <command_parameters>
    <command_parameter id="0" name="APPs_Code">ATAiOS</command_parameter>
  </command_parameters>
  <command_result>
    <apps_products>
      <apps_products id="1">
        <apps_code>ATAiOS</apps_code>
        <apps_product_id>2</apps_product_id>
        <brand_id>2</brand_id>
        <brand_desc>Generic</brand_desc>
        <brand_product_id>2</brand_product_id>
        <product_id>001-7</product_id>
        <descrizione>MyTravelApp</descrizione>
      </apps_products>
    </apps_products>
  </command_result>
</command>
Run Code Online (Sandbox Code Playgroud)

我正在使用来自此站点的XMLReader支持文件:

XMLReader的

我正在使用此代码将XML转换为JSON

NSError *parseError = nil;
NSDictionary *xmlDictionary = [XMLReader dictionaryForXMLString:testXMLString error:&parseError];
NSLog(@" %@", xmlDictionary);
Run Code Online (Sandbox Code Playgroud)

我得到了像这样的JSON响应:

commands =         {
        command =             {
            "command_parameters" =                 {
                "command_parameter" =                     {
                    id = 0;
                    name = "APPs_Code";
                    text = "\n  \n    \n      \n        ATAiOS";
                };
                text = "\n      ";
            };
            "command_result" =                 {
                "apps_products" =                     { …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c ios ios6

10
推荐指数
1
解决办法
2万
查看次数

在UIButton上有多个UITextField键盘关闭点击iOS

在我的班上,我有超过30个UITextField和一个UIButton.当我点击uibutton时,我需要重新签名所有uitextfield的键盘而不给所有30个uitextfields提供resignfirstresponder.

我的代码是这样的

-(IBAction)click:(id)sender
{
   [txt1 resignFirstResponder];
   [txt2 resignFirstResponder];
   [txt3 resignFirstResponder];
   [txt4 resignFirstResponder];
   .
   .
   .
   [txt30 resignFirstResponder];
 }
Run Code Online (Sandbox Code Playgroud)

我需要简单的方法来重新签名UITextField键盘

objective-c uitextfield ios

0
推荐指数
1
解决办法
1291
查看次数

标签 统计

ios ×2

objective-c ×2

ios6 ×1

uitextfield ×1

xcode ×1