didSelectRowAtIndexPath for the entire cell does not work - uitableview

I have made a custom UITableViewCell, this cell has icons, labels and text views within it. I want to make the entire cell clickable but i can't make it work.
I use the following code to handle the click
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
This only works if you touch the cell where there are no textviews, how do i make the entire cell clickable?

Related

Remove the UItableview cell segue button?

I was just wondering if it was possible to remove the button that is automatically added to the UItableview cell when creating a segue in storyboard between the cell background and the destination view. For my app, it takes up to much space. I'd rather the user just tap any where on the cell to activate the segue.
Does anyone know how to do this? When I select the button in the cell and hit delete, the whole cell deletes.
Try adding the following code to your cellForRowAtIndexPath method:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
cell.accessoryType = UITableViewCellAccessoryNone;
}
eddwinpaz answer is what worked for me (as I was using storyboard and not doing it with code)
"Select on storyboard Atributes inspector and select the tablecell you don't want it to appear the Accesory and then select Accessory: none"

UITableView - how to recognize if i drag a cell over a cell?

I want to recognize when i select a cell and drag it over another cell.
Is there any example/ workaround for this?
My goal is to create an UITableView which allows me to merge two cells into one cell.
Thanks
You can use UITableView delegates
to move rows
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
And To compare CGRects
self.tableView rectForRowAtIndexPath:(NSIndexPath *)
Then, I believe, create, insert new cell.

Using the UIView-Glow category on UITableViewCell

I'm using the UIView-Glow category trying to highlight certain UITableViewCells. But it doesn't work if it's used in tableView:cellForRowAtIndexPath:.
I guess it must be used after the certain view appeared on the screen. So, is there a possibility to let certain UITableViewCells glow (even when scrolling the table view)?
Yes, there is possibility to let certain UITableViewCells glow with the category file you mentioned. You need to call the category methods in the table view delegate willDisplayCell instead of cellForRowAtIndexPath.
For example:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
[cell startGlowing];
}

iOS: How to add/insert specific cell with identifier into UITableView?

I have grouped static cells in a UITableView. Now I'd like to add or delete (what is easier?) one specific cell, which I've already created in my storyboard. It depends on one NSString: If my string == YES, the cell should be displayed, else it shouldn't.
already tried tableView:insertRowsAtIndexPaths:withRowAnimation:
What you need is:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
This method is part of the UITableViewDelegate protocol and will be called when the table view is about to draw a cell for a particular row. This provides a UITableViewCell for you to work with.
To identify which cell you need to hide, you can add a tag to the UITableViewCell in the storyboard. This is easier because you are adding static cells.
Then you can just do:
if ([cell tag] == someInteger) {
cell.hidden = YES;
}
You can wrap this in a condition based on the value of your string that you have mentioned.
I have added some example code on Github to illustrate this.

iPhone UITableView after refresh cell separation is appear

How to refresh cell and add subview without showing separate line?
After reload cell - height is changing and in - (UITableViewCell *)tableView:(UITableView *)tableView_ cellForRowAtIndexPath:(NSIndexPath *)indexPath method I adding custom view to cell and the white separate line is appear but after scrolling TableView separate line is hidden

Resources