M13checkbox inside UITableView cell fires when click on cell - ios

as the title I'm can put M13checkbox inside the cell and all of it works fine, the only problem is when I click outside the checkbox, it also reacts, so the checkbox will be changing it's state
Can anyone help?
I'm assuming it's something about UIGestureRecognizer
Thank you

I figured out how to do it my simply disable tableview allowselection
self.yourtableview.allowsSelection = false
for anyone who needs to do what I was tring to do

Related

Can't update text of UITextView in a custom UITableViewCell

I've been running into an issue that seems to keep coming up on the web, but have been unable to resolve the issue... I'm trying to set the text of a UITextView that's inside of a custom UITableViewCell in a load function that's called on the cell when it's contents are being rendered in its table view.
These are my current settings on my textview that's inside my custom tableviewcell. Note that UserInteraction is NOT enabled, but Editable and Selectable ARE.
This is the controller for my custom UITableViewCell, which contains the function 'loadCell'
This is the cellForRowAtIndexPath that puts the custom tableViewCell into the tableView, and it calls the loadCell() function when it's initialized.
This is the result, with the textView obviously not being updated correctly.
Another note I'd like to add is that if I update the textView during the awakeFromNib function in the custom UITableViewCell controller, it successfully is able to change the text in the textField.
If anyone can help me out, that would be super duper awesome, as I'd love to be able to use textViews instead of labels :) Thanks!
So, it turns out that the problem was in the cellForRowAtIndexPath function, in which I was attempting to dequeueReusableCell twice (once at the functions start, and once if the index was 0). I'm not entirely sure why this is causing a problem, though I can make an assumption that it was attempting to dequeue the same cell twice, and was causing problems.
Either way, getting rid of
let cell = tableView.dequeueReusableCellWithIdentifier("MenuItemDescriptionCell")
did the trick.
Hope this helps someone in the future! Happy coding :)

Fading out a disclosure indicator

I'm building an app where I've got cells that expand, similar to when you create a new event in iOS' built in calendar app. One of the expanding cells have a disclosure indicator set in storyboard, but return nil when logging it. I've tried to set it both in StoryBoard and like this:
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
and I'm trying to fade it out like this:
self.cell.accessoryView.alpha = 0.0f;
but it doesn't work as it's nil.
Can someone help me with this? Why is it nil? I'm using StoryBoard with a UITableViewController that's static and grouped.
Thanks!
Erik
You'd have to provide your own accessoryView. accessoryView will be nil if you're using an accessoryType.
Remember to add a little logic in tableView:cellForRowAtIndexPath: to decide whether or not to show your accessoryView as well since the cells get reused.

UICollectionViewCell is being selected multiple times when scrolling down?

I have a custom UIView checkmark icon that shows up when the user taps a particular subclassed UICollectionViewCell. However, when I scroll the icon appears on multiple cells without the user actually tapping on those cells. From what I researched so far, it appears this is caused from the cell reuse.
What would be some good solutions to fix this issue?
Appreciate any help!
Good thing to do would be to create a property in your subclassed cell as isSelected. And then in the item creation method put a check
if (item.isSelected) {
//show checkmark
} else {
//remove checkmark
}
This way is the item does not have the iSelected Property set as true, the extra checkboxes will not come.

TableView editing style

I've got a tableView with entries which the user should be able to edit. The special thing is, the tableView has a "right detail" style (a number) and I want this right detail to be replaced (animated if possible) with the standard disclosure indicator accessory, when the user hits edit.
How can I do this? Thank you!
Update: Thank you for the answers so far but could you maybe give me a code example for the part where the number gets replaced by the picture? Thank you!
You can make use of the UITableViewDelegate methods for editing such as tableView:willBeginEditingRowAtIndexPath: to perform your changes. Use cellForRowAtIndexPath: to get the UITableViewCell object.
You can use a custom cell here and do all those works. Here you can use the same cell and add a subview to that cell where you want that change to happen. Later depending on the state i.e; isEditing = True/ false you can display what you want.

How to disable: Drag across UITableViewCell selects it

When you drag over a UITableViewCell in a TableView, the cell gets highlighted ("selected"), but didSelectRow... is not called. I wish to disable that selection. How would I do that? Note that setting the selectedStyle for a cell to selectedStyleNone, or something like that, is not what I want. I really want the OS not to select it.
Thanks in advance,
I think the property your searching for is BOOL allowsSelection declared in UITableView. By passing "no" the tableViewCell is not selected when the user touches it. The same is true for BOOL allowsSelectionDuringEditing.
I hope that fixes your problem ;)

Resources