如何循环每个字典键和值并在UILabel中打印

时间:2016-10-11 15:35:26

标签: ios swift dictionary foreach uilabel

我已经创建了一个词典值UILabel,我想循环每个词典值和键并打印出每个值并键入其自己的UILabelUITextView

这是我的代码--->>

var cabinets = ["Kitchen": "An effective way to make a modern statement in your kitchen is to make a drastic change to your existing cabinets. Even if you’re on a tight budget, by hiring a trusted kitchen cabinet remodeling company, you could appreciate the outcome you’re provided with for years to come.", "Living Room": "Blah Blah. is locally owned and operated in Portland, OR, and our courteous contractors are dedicated to offering customized support. We're available to assist you Monday - Friday, 9am - 6pm, and Saturday - Sunday, by appointment.", "Bathroom": "At Blah Blah., we understand the importance of having enough room to house the items you use on a regular basis. That's why we offer a wide selection of bathroom cabinets in all shapes and sizes.", "Closets": "We’ve got the muscle, the tools, and the coordination to seamlessly install beautiful new custom closets in your home or place of business."]

for key in cabinets.keys{

    if let value = cabinets[key] {
        UILabel = value
        titleLabel.text = key
    }

}

0 个答案:

没有答案