我有UITableViewCell
UIScrollView
:
cellScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 43)];
cellScroll.contentSize = CGSizeMake(960, 43);
cellScroll.contentOffset = CGPointMake(320, 0);
cellScroll.decelerationRate = UIScrollViewDecelerationRateFast;
[cell addSubview:cellScroll];
使用此代码解决了UIButton
此问题:
UIView *animationView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 960, 43)];
[cellScroll addSubview:animationView];
cellButton = [UIButton buttonWithType:UIButtonTypeCustom];
cellButton.frame = CGRectMake(320, 0, 320, 43);
[cellButton addTarget:self action:@selector(didPushCellButton:event:) forControlEvents:UIControlEventTouchUpInside];
[animationView addSubview:cellButton];
- (void)didPushCellButton:(id)sender event:(id)event {
NSSet *touches = [event allTouches];
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:theTable];
NSIndexPath *indexPath = [theTable indexPathForRowAtPoint:currentTouchPosition];
}
我也尝试使用UIScrollView
,但这不起作用。
此外,我还尝试了其他一些手势等等。
但没有任何作用。
任何人都可以帮助我吗?
提前谢谢。