2016-12-30 4 views
-3

変更にエラーあいまいな参照複数選択ボタンのスタイルレポートテーブル内のメンバー「サブビュー」

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/ 
+3

あなたのコードがありますObjCとSwiftの混在...私はそれが迅速または客観的な-cコンパイラの下でコンパイルできるとは思わない... – Sweeper

+0

私はswiftでプログラミングしていますが、問題はありませんが、速やかにエラー – user7357445

答えて

0

何かこの:

for circleImage: UIView in subCell.subviews! { 
    if let circleImage = circleImage as? UIImageView { 
     circleImage.image = UIImage(named: "CellButtonSelected")! 
    }     
} 
+0

です。もう質問はありません、ありがとうございます – user7357445

+0

セル選択エラーがいつ発生する – user7357445

+0

新しい問題 – user7357445

0
The button click event custom selection button collapsed  

    for row in 0...self.collectionBookList.count { 
       let indexPath=NSIndexPath.init(forRow: row, inSection: 0) 
       self.myTableView.selectRowAtIndexPath(indexPath, animated: false, scrollPosition:.Bottom) 
       let subviews = self.myTableView.cellForRowAtIndexPath(indexPath)!.subviews 
       for subCell: AnyObject in subviews { 
        if (subCell is UIControl) { 
         for circleImage: UIView in subCell.subviews! { 
          if let circleImage = circleImage as? UIImageView { 
           circleImage.image = UIImage(named: "delete")! 
          } 
         } 
        } 
       } 
      } 
関連する問題