2016-07-06 6 views
0

サイズ50の配列を持っていて、配列から各セルに5枚ずつイメージを印刷する方法があるかどうか疑問に思っていましたか?例えば、セル1は、0からのイメージがあります - 4を、セル2:5から9 ...助けをスワイプのcustomTableViewセルに5枚の画像を印刷

おかげ

EDIT:これはないOSX

用iOS用です
+0

あなたはiOSのか、Oについて尋ねているを使用することをお勧めしますS X? –

+0

iOS。 – user3175707

+0

iOSの場合、あなたは 'UIStackView'のほうが良いかもしれません。 –

答えて

0

あなたがいる場合

  1. は、あなたがそれらを
  2. 目でそれを設定し、UITableViewCellを拡張するクラスを作るようにしたいと思い位置にセルに5 ImageViewsを追加し、ストーリーボード内のセルのプロトタイプを作成します。その後、必要にUItableViewを使うことに決めoryboardプロトタイプセルのためのクラスとして、drangドロップしますが、このような何かしたいと思う、あなたはそれを使用するクラスでは、そのクラス
  3. にコンセントとしてImageViewsを:

    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> MyCustomTablleCellWithFiveImagesInIt { 
    
        let cell = tableView.dequeueReusableCellWithIdentifier("MyReusableCellID", forIndexPath: indexPath) 
    
        cell.image1 = datasource[indexPath.row * 5 + 0] 
        cell.image2 = datasource[indexPath.row * 5 + 1] 
        cell.image3 = datasource[indexPath.row * 5 + 2] 
        cell.image4 = datasource[indexPath.row * 5 + 3] 
        cell.image5 = datasource[indexPath.row * 5 + 4] 
    
        return cell 
    } 
    

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 

    return datasource.count/5 
} 

に忘れてはいけません。しかし、私はあなたではなくUICollectionView

関連する問題