Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios14 , TableView:didSelectRowAtIndexPath not called

after ios14 update TableView:didSelectRowAtIndexPath is not called. Running the same source in ios13 works normally

tableview A Click to add to the parent view [self.superview addsubview:A] I added a table view like this So the delegate is received from the current view Until ios13 is normal, why not?

like image 818
ttoggaiman Avatar asked Nov 07 '22 05:11

ttoggaiman


1 Answers

There are two methodologies:

First

When you're using UITableViewController then it's automatically conformed to UITableViewDataSource and UITableViewDelegate protocols.

@interface UITableViewController : UIViewController;

Second

In case you're using UITableView you have to conform it to both protocols – UITableViewDataSource and UITableViewDelegate and assign two class delegates.

@interface UITableView : UIScrollView;

@property(nonatomic, weak) id<UITableViewDelegate> delegate;
@property(nonatomic, weak) id<UITableViewDataSource> dataSource;

If both methodologies don't work, so it's definitely a bug in iOS 14.

About method:

tableView:didSelectRowAtIndexPath:

Apple documentation says:

The system doesn’t call this method if the rows in the table aren’t selectable. See Handling Row Selection in a Table View for more information on controlling table row selection behavior.

like image 181
Andy Jazz Avatar answered Nov 19 '22 22:11

Andy Jazz