變動表中的多項選擇按鈕樣式報告的錯誤不明確的參考成員「子視圖」
NSArray *subviews = [[tableView cellForRowAtIndexPath:indexPath] subviews];/* An array of */
for (id subCell in subviews) {
if ([subCell isKindOfClass:[UIControl class]]) {
for (UIImageView *circleImage in [subCell subviews]) {
circleImage.image = [UIImage imageNamed:@"CellButtonSelected"];
}
}
}
/* change */
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) /* table Proxy method */
var subviews = tableView.cellForRowAtIndexPath(indexPath)!.subviews
for subCell: AnyObject in subviews {
if (subCell is UIControl) {
for circleImage: UIImageView in subCell.subviews { /* report an error Ambiguous reference to member 'subviews' */
/* How to solve?*/
circleImage.image = UIImage(named: "CellButtonSelected")!
}
}
}
報告的錯誤不明確的參考成員「子視圖」
/**Swift, the table of custom boxes, no system, how to change/
你的代碼是ObjC和Swift的混合...我不認爲它可以在swift或objective-c編譯器下編譯... – Sweeper
我用swift編程,OC代碼沒問題,變成swift是錯誤 – user7357445