我有一个包含多个单元格的表格视图。
除最后两个单元格外,所有单元格都很好地处理了点击侦听器。 当我按下红色突出显示的部分时,第一个仅处理点击,而第二个则不处理。
这是屏幕截图。任何人都可以告诉我如何知道此问题的原因,因为其他所有单元都工作正常。
编辑
这是单元格元素
这是代码
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath{
[tableView deselectRowAtIndexPath:newIndexPath animated:YES];
KYDrawerController *elDrawer = (KYDrawerController*)self.navigationController.parentViewController;
MainViewControllerObjc *viewController = [[UIStoryboard storyboardWithName:@"Forsa" bundle:nil] instantiateViewControllerWithIdentifier:@"MainController"];
UINavigationController *navController=[[UINavigationController alloc]initWithRootViewController:viewController];
ForsaDataManager *sharedManager = [ForsaDataManager instance];
SocialResponse *social = [sharedManager socialLinks];
DrawerItem *test = [DrawerItem new];
test = [self.dataSource objectAtIndex: newIndexPath.row];
if ([test.tag isEqualToString:@"Login"]) {
[self openLogin];
} else if ([test.tag isEqualToString:@"Logout"]) {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger:0 forKey:@"user-id-key"];
[defaults setObject:@"" forKey:@"user-name-key"];
[defaults setObject:@"" forKey:@"user-email-key"];
[defaults setObject:@"" forKey:@"user-profile-key"];
[defaults synchronize];
dispatch_async(dispatch_get_main_queue(), ^{
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Forsa" bundle:nil];
SplashViewController * secondViewController = (SplashViewController *)[sb instantiateViewControllerWithIdentifier:@"splash"];
[self presentViewController:secondViewController animated:YES completion:nil];
});
} else if ([test.tag isEqualToString:@"Register"]){
[self openRegister];
} else if ([test.tag isEqualToString:@"Favorite"]){
viewController.categoryId = -2;
viewController.categoryName = @"التفضيلات";
} else if ([test.tag isEqualToString:@"Facebook"]){
[self openURL:social.facebook];
} else if ([test.tag isEqualToString:@"Twitter"]){
[self openURL:social.twitter];
} else if ([test.tag isEqualToString:@"Youtube"]){
[self openURL:social.youtube];
} else if ([test.tag isEqualToString:@"Contact Us"]){
[self openContactUs];
} else if ([test.tag isEqualToString:@"About Us"]){
int tag = 56;
[self openAboutUs:(tag)];
} else if ([test.tag isEqualToString:@"Terms"]){
int tag = 57;
[self openAboutUs:(tag)];
} else if ([test.tag isEqualToString:@"Main"]){
viewController.categoryId = -1;
} else if([test.tag hasPrefix:@"Service_"]){
NSString *string = [test.tag stringByReplacingOccurrencesOfString:@"Service_" withString:@""];
int catId = [string intValue];
viewController.categoryId = catId;
viewController.categoryName = test.title;
}
elDrawer.mainViewController=navController;
[elDrawer setDrawerStateWithState:(DrawerStateClosed) animated:(YES)];
}
答案 0 :(得分:0)
由于测试是在iPhone X上进行的,因此保留了一个触摸区域,而不是删除了主页按钮(底部safeAreaLayoutGuide),您需要插入表格的底部,或者至少在iPhone上增加底部约束的常数值-X