UIButton and other elements not accessuble inside UICollectionView when using custom UICollectionViewCell - ios

I have created a custom UICollectionViewCell which contains UILabels, UIButtons and UITextFields. The custom cell is successfully loaded and appears properly on the device screen but the problem is I cant seem to intercept any touch events on the elements of the custom cell in the collection view.
What could be the problem?

Related

UITableViewCell inside UICollectionView not selectable

I have a UIViewCollectionView. The Cells for the collection are all clickable. Each cell contains a UITableView and I also want the cells of that table view to be selectable but they arent.
I set isUserInteractionEnabled = true on the UICollectionView, UICollectionViewCell, UITableView and the UITableViewCell but I cant get the clicking working on the table view cells.
How can I do it?
In general I want all user inputs on the table view to have priority.
I have no idea why but it did not work because I used xib files instead of storyboard. I switched to storyboard and everything works fine.

UITableView within Subclassed UIView

I have a UIView that I subclassed to use as a slideout menu. Prior to trying to implement a tableview, I had programmatically added buttons with images and titles. It worked fine.
Currently I'm working with a subclassed UIView with a UITableView on top. I have a subclassed UITableViewCell and both subclasses have xibs.
The problem is that I can't seem to figure out how to have the tableview show up. I have the delegate methods in place as well as setting the tableviewcell as the dequeued cell.
The question I would like to figure out is how to get the tableview to show up. The background of the menu shows up but no tableview on top. Thanks for the help.

MPMoviePlayerController reuse in a custom UITableViewCell

I am working on creating a table where each cell has a play button and a MPMoviePlayerController. It is setup so that I have custom UITableViewCell class that loads a .xib. Just to make sure the cells are being reused correctly, I have the tableView Controller set a number for the button title (whatever the indexpath.row is). This displays correctly, but when I play one of the cell's videos and scroll down quickly it appears again in another cell. How can I resolve this?

Using a Custom UITableViewCell with Prototype Cells

For reference, this tutorial I am following: http://mobile.tutsplus.com/tutorials/iphone/customizing-uitableview-cell/
I have to create a custom UITableViewCell, and from the tutorial, it said to leverage Prototyping cells and subclass UITableViewCell. Then connect the UI elements in the prototype cel to the custom class (of UITableViewCell).
The problem I am running into here is, there is only one cell for the whole table view that is displaying data. However, I am able to click on empty cells in the background behind that one cell that contains data. If i scroll up or down, cellForRowAtIndexPath is called and another cell gets displayed. However its only displaying once cell at a time for the whole table view.
Does anyone know what the problem could be here? Any help is appreciated, thanks!
Figured out what the problem is, my labels (that are supposed to be inside the custom prototyping cell) were added to the parent view and not the content view of UITableViewCell. This is because my prototype cell did not have a content view for some reason. I had to add a another prototype cell and delete the previous one.
reference: How to add subviews to a custom UITableViewCell in a storyboard

Pass touch events to a UICollectionViewCell contents?

I have a UICollectionView that displays cells that can have multiple types of content. The content could be a view, a scrollview, a button, etc. For the most part, the table is displaying correctly, but touch events to not appear to be getting passed down to the cell contents. (Buttons aren't accepting clicks, scrollviews aren't scrolling).
Is there a way to pass the touch events to the contents on each cell?
Are you loading the UICollectionViewCell from nib? The elements in the nib are not added to the UICollectionViewCell's contentView and thus the events are not going through to cell contents.
I had the same problem wit a cell loaded from nib including a UITableView and I was able to fix it by manually adding the table to contentView like this:
[self.contentView addSubview:_tableView];
I found the fix here.

Resources