Touch Event Detection in UIImageView inside UITableViewCell - ios

I am trying to detect a touch event in UIImageView which is added in UITableViewCell's contentView. But, Imageview is not triggering the touch event, i have enabled the imageview userinteraction too. Basically, I am trying to drag image from UItableViewcell to somother view/place. do you guyz have the solution of it, dragging images from UITableViewcell to otherviews.

create a custom UIView and add ImageView on that view as a subview then add touch event on that view.
then add that view on Cell content View

Related

How to zoom image without zooming subviews of an image? swift ios

I added UIImageView which is subview of UIScrollView. Then I added UIButton is subview of UIImageView. When I zoom UIImageView then UIButton is also perform zooming. I want only zoom UIImageView not UIButton. How can I achieve this?
Since UIButton is subview of UIImageView, it will pan/zoom when you zoom/pan UIImageView. To solve your problem, make it subview of some other view, perhaps UIScrollView in your case.

Does UITableViewCell accessoryView has superview?

I assigned a UIView to a UITableViewCell's accessoryView then when i try to get the superView of it seems it's nil?
So does accessoryView has a superview? If no how does it appears?
A view cannot appear on screen unless it has a superview (or is itself a UIWindow).
You may be checking the superview property before it has been set. The accessory view is added as a subview of the cell by the cell's layoutSubviews method. It doesn't happen immediately upon setting the cell's accessoryView property.
If you replace an accessory view with another accessory view, the old accessory view will be removed from its superview (the cell) immediately (inside the setAccessoryView: method), but the new accessory view won't be added to the cell until the cell's layoutSubviews runs.

iOS - UICollectionView in UITableViewCell, problems when handling touch

I have a UICollectionView in every UITableViewCell of my UITableView.
The program should perform a segue there is a click on the UITableViewCell but the cell is clickable just out of the UICollectionView.
It is clickable just in the red portions.
Do you have any ideas?
You need to disable user interaction in each collection view:
In your storyboard uncheck here:
Or in your cellForRowAtIndexPath:
cell.collectionView.userInteractionEnabled = NO;

UITableView inside UITableViewCell not receiving touch events

So I have a UITableView nested inside a UITableViewCell, like:
UITableView baseTable
UITableViewCell baseTableCell0
UITableView subTableView
UITableViewCell subTableViewCell
UIView subView
UITableViewCell baseTableCell1
UICollectionView subCollectionView
UICollectionViewCell subCollectionViewCell
subView has a UITapGestureRecognizer connected, acts like a button
subTableView and subCollectionView should receives touch events and perform didSelectRowAtIndexPath
On iOS 8 this works fine, but when i'm testing on ios 7 the cells in subTableView and subCollectionView does not receives touch event anymore, the touch event is sent to [baseTableView tableview... didSelectRowAtIndexPath]. However the UITapGestureRecognizer on subView can still receive touch event.
update: ios 6 has this problem as well, so it only works on ios 8 so far
Use this code on tab gesture object
tap.cancelsTouchesInView = NO;
Try changing the background color of your UITableView, UITableViewCell and UIView, this way you can see if your child view is not exceeding your parent view, if it is the case your child view is not going to receive touch events. Then either adjust Parent to show child fully or adjust child to remain in the parent boundary.
Hope it helps!
EDIT:
May be passing touch events to subviews can help.

UICollectionView scroll if vertical, move cell if horizontal

I have a UICollectionView that scrolls vertically but only if I am not touching a cell or it's content.
UICollectionView -> UICollectionViewCell -> UIView
The UIView has a pan gesture
- (void)move:(UIPanGestureRecognizer*)recognizer{}
which I use to move the UIView around. If the UIView is in the UICollectionView it is restricted to only horizontal movement. If I move the UIView out of the bounds of the UICollectionView then it is removed from the collection.
I want the UICollectionView to scroll vertically if I am moving my finger vertically, which would have to cause the touch events on the UIView to be ignored. But if I move horizontally the touch events will not be ignored on the UIView.
I can't seem to figure out how to accomplish this. Advice would be greatly appreciated.

Resources