ios14更新后TableView:未调用didSelectRowAtIndexPath。在ios13中运行相同的源代码可以正常工作
表格视图单击添加到父视图self.superview ios13 :A我添加了一个这样的表视图,以便从当前视图接收委托,直到表视图正常,有何不可?
发布于 2020-09-26 04:05:00
有两种方法:
First
当你使用UITableViewController时,它会自动遵循UITableViewDataSource和UITableViewDelegate协议。
@interface UITableViewController : UIViewController;第二个
如果你正在使用UITableView,你必须使它符合两个协议-- UITableViewDataSource和UITableViewDelegate,并分配两个类委托。
@interface UITableView : UIScrollView;
@property(nonatomic, weak) id<UITableViewDelegate> delegate;
@property(nonatomic, weak) id<UITableViewDataSource> dataSource;如果这两种方法都不起作用,那么这肯定是iOS 14中的一个错误。
关于方法:
tableView:didSelectRowAtIndexPath:Apple文档中写道:
如果表中的行不可选,则系统不会调用此方法。有关控制表行选择行为的更多信息,请参见Handling Row Selection in a Table View。
发布于 2020-10-13 23:25:22
这肯定是一个iOS 14的bug,我也遇到了同样的问题(我相信)。我认为这篇推特帖子揭示了这个问题。假设您的问题与我的问题相同,您现在需要将单元格上的子视图添加到其contentViews中。https://twitter.com/smileyborg/status/1276623198059036672
[tableViewCell addSubView:] - > [tableViewCell.contentView addSubView:]https://stackoverflow.com/questions/64064413
复制相似问题