I ran into the problem that I need to invoke swipes for all cells except the last one by calling SetEdit. That is, I click on the Edit button, a number of cells are shifted to the right and their actions are shown. They should be static in this position and you can, for example, click on deleting or editing a cell. Is this even possible?
I have already tried a lot of things, but I could not even achieve the result.
Thanks in advance !
Related
I have a tableView with tableViewCell. The cell contains three labels. When you edit an existing cell (by tapping it) or create a new one (by tapping a "plus"-button) you see a new viewController where you can change the content of those three labels.
All of this works fine, but when you edit (or add) a second time and save it, the first label magically changes it position (it moves down and to the left). If you close the app and reopen is, everything is at the right position again.
I just cannot understand why this is happening. The labels are inside a stack, have constraints and everything.
Does anyone have any idea? Or did anyone have a similar problem and was able to solve it?
Thank you very much!
I have a basic UICollectionView and a basic list of items. I've implemented a delete button on the items so that the user can remove some of them. Everything works great apart from the item rearrangement while the item is being deleted.
If you delete the item N-1, it visually deletes the first one in the list, moves the last one to the first position and "reuses all the cells" to set the correct content.
Basically, I would have expected it to move the last one to the N-1 item.
NOTE: This expected behavior happens when I've got one line and 2 items which makes me believe I did things right somehow.
Questions are :
Is this the standard behaviour of a collection view when deleting object ?
How can I fix it quickly without rewriting the whole thing ?
I figured out the problem. It happened that I was posting a notification after the deleteItemAtIndexPath which was actually calling a setter which was calling collectionView reloadData. This reloadData wasn't supposed to be called at this stage so I fixed it and it works like a charm.
So, if you have funny animations make sure you're not calling a reloadData in a way or another.
I want a cell in UICollectionView can be tapped(not selected,because selected cell would be add to the [cllectionView indexPathsForSelectedItems]), what means: when I tap a cell I can show a detail view of the cell and it would not be add to [cllectionView indexPathsForSelectedItems].
AFAIK, there is no way to do this at this time -- other than to deselect the item after the selection is made. I spent a lot of time trying to make this happen and it just doesn't work.
The problem is this: You have to get hold of the default gesture recognizer for the collectionView tap to require it to fail, and you can't. Apple gives some instructions, but they don't work as advertised. See page 36 of:
http://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/CollectionViewPGforIOS/CollectionViewPGforIOS.pdf
The problem is that the sample code in this article doesn't work. On inspecting the default gesture recognizers, you'll find there isn't one of the class type UITapGesureRecognizer. It may be you can figure out what's going on with it, but I never could (if you figure it out, I'd sure like to know how to do it).
Ultimately, everyone workaround I tried failed, and I ended up having to settle for using a long press. There are some other posts on this subject, but I never could find anything else that actually worked. This was all on iOS 6.0.
Someone had also asked about using a double tap, and I could not get the select to consistently fail on that. At first I thought that was the solution, but found that it would sporadically select the cell that was double-tapped, and with no other workaround had to move to the long press, which seemed to work. In the end I had to scrap that work for other reasons, so I never put it in production.
Hope you can find a solution but my experience was not good.
Have a strange issue where about 15% of the time, when selecting a cell with a UITableView the cell highlight flashes quickly and didSelectRowAtIndexPath is not called. The rest of the time it is working fine.
Tested how it was being selected (fast / slow finger nail, etc), but this does not seem to be the case. Looks semi-random.
Any thoughts one what might be causing this?
IOS 6.x
[Addition]
Thanks for the comments so far.
If while clicking the mouse (simulator) is moving, the problem can be duplicated. Even if the table is set to .scrollEnabled = false it is still happening. Also, the didHighlightRowAtIndexPath does fire and the didSelectRowAtIndexPath does not in the "quick" case.
Same thing happens on IOS 5.x also...
[Conclusion]
Well, it turns out that the scrolling was turned off for the table and it seems to be even more picky with the "moving tap" Turning the scrolling on actually made the "moving tap" less picky. There were a couple of other postings that I just found that pretty much said the same thing. This is a strange conclusion for a table view that has scrolling disabled and produces a "quick highlight" with no selection. Looks like this is why they added the didHighlight in IOS 6 to try and get around this "issue".
is it possible that a view from with in the cell is absorbing the touch rather than the cell ?
maybe you have a gesture recognizer in the cell, those take priorities over simple touch events
It seems that for some reason your cell is disabled. Try setting cell.enabled = TRUE; right before the cell is displayed and see if it fixes anything.
You're moving your finger up or down slightly, causing the table to scroll. Your item will not be selected, and the highlight will disappear. I've dealt with this before by tracking the row in tableView:didHighlightRowAtIndexPath, and then doing the action in tableView:didUnhighlightRowAtIndexPath: . You might also be able to solve your problem by making the tableView not scrollable if that's an option in your ui.
Pretty straight forward, I just can't get it to work. What can I do to swipe to delete on my tableView that is within a page control?
Please help!
Edited to remove my original answer regarding the proper UITableViewDataSource methods.
This sounds like a potentially complicated user interface (i.e. if users are expecting swipes to turn a page but if they mis-touch and hit the table view cell just right, they'll get the "delete" button). I'd suggest re-thinking what you are doing.
In any event, to get to the finish line on your app might be to subclass UIPageControl, detect when swipes are happening in the content region and pass that swipe message along to the table view. I suspect you can't just do userInteractionEnabled = NO; on the page control's content view.
F.Y.I.: you should also probably delete the identical & duplicate question you posted a number of hours before the question I'm attempting to answer ( How can I capture a sideways swipe gesture for a tableView that is inside of a pageControl? )