swift2 table.viewWithTag

swift2 table.viewWithTag

エラーばっかりです。。。

fatal error: unexpectedly found nil while unwrapping an Optional value

てか、、設置したところが
Table → Cell → imageView
なら

スクリーンショット 2016-03-14 10.50.10

table.viewWithTag
というか
cell.viewWithTag???

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
    let cell = tableView.dequeueReusableCellWithIdentifier("newsCell", forIndexPath: indexPath)
        
    let imageView = cell.viewWithTag(1) as! UIImageView
    imageView.image = UIImage(named: "logo_title")

    //以下省略〜〜

}

これで合ってるのか
他に書き方があるのか
そもそも設置がおかしいのか・・・
は分かりませんが、エラーは出なくなりました。

この先進めてゆくとまた他に何か色々分かるかも知れません。
昨日はここで疲れて閉店。。


コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

*