gpt4 book ai didi

ios - '[(UIButton) ]' does not have a member named ' enumerate' 谁能指导我解决这个错误?

转载 作者:行者123 更新时间:2023-11-28 09:00:30 24 4
gpt4 key购买 nike

for (index, button) in ratingButtons.enumerate() <--getting my error here
{
buttonFrame.origin.x = CGFloat(index * (44 + 5))
button.frame = buttonFrame
}
}

我也试过 enumerate(ratingButtons) 但它没有在数组中添加按钮

最佳答案

取出 .enumerate() 它应该可以工作,还必须将 (index, button) 更改为 button,因为该数组只包含 UIButtons,而不包含索引和按钮的元组。如果需要索引,则必须手动计算数组的迭代次数,否则设置一个普通的非快速枚举 for 循环并手动获取索引处的按钮

关于ios - '[(UIButton) ]' does not have a member named ' enumerate' 谁能指导我解决这个错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32112229/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com