###前提・実現したいこと
・UILabelがUIImageViewの後ろに隠れないようにしたい
・UIImageViewが最背面で画像の上にラベルがかぶさる感じ
###発生している問題・エラーメッセージ
###該当のソースコード
Swift
1import UIKit 2 3class ViewController: UIViewController, UITableViewDataSource { 4 5 override func viewDidLoad() { 6 super.viewDidLoad() 7 } 8 9 func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 10 return 10 11 } 12 13 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 14 let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) 15 let imageView = cell.viewWithTag(10) as! UIImageView 16 cell.sendSubviewToBack(imageView) 17 return cell 18 } 19 20}
###試したこと
TableViewCell上がダメなのかと思い、ViewControllerに直置きで試したところ
思ったように実装できましたが、今回はCell上でそれを実装する必要がある。
self.view.sendSubviewToBack(imageView)
cell.sendSubviewToBack(imageView)
tableView.sendSubviewToBack(imageView)
上記3つを試した見たが、すべてなんの動作もなかった。
###補足情報(言語/FW/ツール等のバージョンなど)
・Xcode7.3.1
・Swift2
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/10 08:30