程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> iphone-在Xcode中創建NSMutableArray

iphone-在Xcode中創建NSMutableArray

編輯:編程綜合問答
在Xcode中創建NSMutableArray

現在要創建NSMutableArray ,像下面的例子一樣。不知道怎麼實現?

(
        {
        businessName = "IBM Business Continuity & Recovery Service";
        city = "Costa Mesa";
        phone = "(714) 668-6900";
        state = CA;
        street = "600 Anton Blvd";
        zip = 92626;
    },
        {
        businessName = "IBM Sanno";
        city = Lomita;
        phone = "(310) 626-0613";
        state = CA;
        street = "25835 Appian Way";
        zip = 90717;
    },
        {
        businessName = "Ewert's IBM Typewriter Service";
        city = "";
        phone = "(559) 732-3215";
        state = "";
        street = "";
        zip = "";
    },
)

請指教。

最佳回答:


動態添加dictionary。

NSMutableArray *dictionaries = [[NSMutableArray alloc] init];

NSDictionary *exampleDict = [[NSDictionary alloc] initWithObjectsAndKeys:
@"IBM Business Continuity & Recovery Service", @"businessName", 
@"Costa Mesa", @"city", 
@"(714) 668-6900", @"phone", 
@"CA", @"state", 
@"600 Anton Blvd", @"street", 
@"92626", @"zip", nil];

[dictionaries addObject:exampleDict];
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved