我在UITableView
内有UIView
,我们称之为view_A。有一个UIViewController
,称之为mainViewController。里面有一个UIButton
。在点击该按钮时,我将view_A作为子视图添加到mainViewController的视图中。 tableview中有几个菜单项。问题是tableview没有正确响应触摸。我必须长按细胞才能做出选择。它上面没有添加任何手势。没有其他观点可以涵盖它。这种行为绝对是古怪的。请查看以下代码并指出可能导致问题的原因。
这是mainViewcontroller中的委托实现/演示文稿:
-(void) showDropDownMenu: (UIButton *) sender
{
UINib *nib = [UINib nibWithNibName:@"DropDownMenuView" bundle:nil];
self.myView = [[nib instantiateWithOwner:self options:nil] objectAtIndex:0];
self.myView.hidden = NO;
self.myView.tag = 101;
self.myView.delegate = self;
self.myView.btnBack.hidden = YES;
CATransition *transition = nil;
transition = [CATransition animation];
transition.duration = 0.2;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype =kCATransitionFromBottom ;
transition.delegate = self;
[self.myView.layer addAnimation:transition forKey:nil];
[self.view addSubview:self.myView];
}
-(void) hideDropDownMenu
{
CATransition *transition = nil;
transition = [CATransition animation];
transition.duration = 0.2;//kAnimationDuration
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault];
transition.type = kCATransitionPush;
transition.subtype =kCATransitionFromTop;
transition.delegate = self;
[self.myView.layer addAnimation:transition forKey:nil];
self.myView.tag = 102;
[UIView commitAnimations];
}
-(void) navigateBack
{
}
-(void) themeSelected: (NSIndexPath *) indexPath
{
NSLog(@"%ld",(long)indexPath.item);
themeNumber = [NSString stringWithFormat:@"%li",(indexPath.row+1)];
[self setUpTheme];
}
这是cell.h文件的实现:
@interface ThemeTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *themeName;
@property (weak, nonatomic) IBOutlet UIImageView *themePreview;
这是cell.m文件的实现:
#import "ThemeTableViewCell.h"
@implementation ThemeTableViewCell
- (void)awakeFromNib {
// Initialization code
//ORIGINAL 82
self.clipsToBounds = YES;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
答案 0 :(得分:0)
您是否禁用了cell imageview userInteraction,如果没有尝试此cell.yourImageView.userInteractionEnabled = NO