Questions tagged «for-in-loop»

6
在for-in循环中进行类型转换
我有这个for-in循环: for button in view.subviews { } 现在,我希望将按钮强制转换为自定义类,以便可以使用其属性。 我尝试了这个: for button in view.subviews as AClass 但是它不起作用,给我一个错误:'AClass' does not conform to protocol 'SequenceType' 我尝试了这个: for button:AClass in view.subviews 但是,这也不起作用。


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.