UITableViewCell make only part of cell selectable - ios

I have a custom TableViewCell and I would like that user can only tap/select the part of the cell in tableview.
I guess that this would be possible if I make the my CustomCell non selectable and then add UIButton inside my CustomCell on which the user can tap.
But are there any other ways of doing it?

Related

How to add two custom cells in tableview at once click on button?

I have tableview in which i have created three different custom cells like below :
TableviewCell1 *cell1;
TableviewCell2 *cell2;
TableviewCell3 *cell3;
It works fine but I need to add two custom cell like
TableviewCell1 *cell1;
TableviewCell2 *cell2;
both are at once added to tableview when add button clicked.
Any responses will be appreciated...

How to distinguish two UITableView having a same custom cell

Hi I have two UITableView in a UIView class and are loaded with same custom UITableViewCell. Custom tableview cell contains a UITextField. That means the two UITableView contains a UITextfield of same custom cell. When I select any of that textfield, how do I know which tableView's textfield is selected? Please help me..
UITextField *txt = ----;
txt.superView.superview will give you the required UITableView instance.
To be more clear :
UITableViewCell *cell = txt.superView; // In your case custom cell
UITableView *yourTable = cell.superView;

How do I pass data to a button click event in Swift IOS?

In my project, there is a UITableView which contains UICollectionViews in each row. Each UICollectionView contains a UIButton. I implemented those by using a tutorial here:
https://ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell-in-swift/
The problem is, I need to add an action to button click. The usual IBAction click works, but I can't pass any data except an integer (tag) to it.
The question is, how do I pass some data to my button click action?
UIButton in UICollectionViewCell
UICollectionViewCell in UICollectionView
UICollectionView in UITableViewCell
UITableViewCell in UITableView
UITableView in UIViewController/UITableViewController
so your button outlet must be on collectionviewcell class and your button's action must be in uicollectionviewcell, and you can pass data from your uicollectionviewcell to UITableViewCell with delegate (uicollectionviewcell-delegate), and UITableViewCell to UIViewController/UITableViewController with another delegate.

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;

iOS - Clickable UITableView with Custom Cell

Good day! I have an app that has UITableView with Custom Cell in it. What i want to do is when i click on a specific row it will do an action based on what is the text on that row or cell if possible. For example. lets say this is a tableview.
Flowers 12 Red
Meat 30 Dry
Mouse 10 Alive
Pen 12 Black
Then i clicked on the Meat row and i have a blank text box, it will show the text "Meat" in the Textbox or label. is that possible? thanks!
Could do something like this:
Remember to have a datasource and a delegate of UITableView and declare your UITextField as a mainTextField property.
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
mainTextField.text = cell.textLabel.text;
}
If you need a more complex structure, you can create UIButtons for each row and with a UITableViewCell subclass with a custom delegate you can catch the events within a custom cell.
add tags to subviews and put tapgesture for cell, and then in tapgesture target u can acces those views based on tags by subclassing uitableviewcell based on tapgesture tag...

Resources