Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift - Outlets cannot be connected to repeating content

The full error is: The playerView outlet from the TableViewController to the AVPlayerView is invalid. Outlets cannot be connected to repeating content.

Similar answers like this one have not worked (assuming I am attempting them correctly, I'm very new to iOS).

All I want is a view within a TableViewCell.

I've tried dragging a View in Storyboard to the contentView (and cell) of my TableViewCell, assigning it a class of AVPlayerView: UIView (and a subclass of tableViewCell: AVPlayerView: UITableViewCell), then ctrl+dragging from that view in the storyboard into my TableViewController. Then it doesn't compile. Really confused, thanks for the help.

like image 586
natecraft1 Avatar asked Jul 21 '15 22:07

natecraft1


1 Answers

Your table view can have static content or dynamic content.

If you want the table view to have always the same content, set it to static (in interface builder), and then you can link the outlets like that, in the UIViewController.

If you want the table view cells to change dynamically, you cannot do it that way. Because you could repeat cells and the outlet would be ambiguous. You need to create a UITableViewCell subclass for your cells, and create the outlets there.

To clarify: in dynamic table mode, you need to ctrl+drag the outlet into the UITableViewCell subclass, not the view controller.

like image 54
Tiago Lira Avatar answered Nov 19 '22 21:11

Tiago Lira