Ios 在UITableViewCell子类中实现自定义滑动功能
我正在尝试重新创建一个在许多应用程序中看到的效果,你有一个带有单元格的表视图,在单元格上滑动,该视图被另一个包含其他按钮的视图所取代 我尝试如下所示:Ios 在UITableViewCell子类中实现自定义滑动功能,ios,uitableview,uikit,Ios,Uitableview,Uikit,我正在尝试重新创建一个在许多应用程序中看到的效果,你有一个带有单元格的表视图,在单元格上滑动,该视图被另一个包含其他按钮的视图所取代 我尝试如下所示: // Hacky hacky RCTReceiptCell *selectedCell = (RCTReceiptCell *)[sender view]; RCTReceiptOptionsCell *optionsCell = [[RCTReceiptOptionsCell alloc] init]; if
// Hacky hacky
RCTReceiptCell *selectedCell = (RCTReceiptCell *)[sender view];
RCTReceiptOptionsCell *optionsCell = [[RCTReceiptOptionsCell alloc] init];
if (optionsCell) {
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *class = NSStringFromClass([RCTReceiptOptionsCell class]);
NSArray *cellComponents = [mainBundle loadNibNamed:class
owner:self
options:nil];
optionsCell = [cellComponents objectAtIndex:0];
}
// Make sure subview gets inserted on top.
NSArray *subviews = [[selectedCell contentView] subviews];
// NSUInteger index = [subviews indexOfObject:[subviews lastObject]];
UIView *selectedCellContentView = selectedCell.contentView;
[selectedCell insertSubview:optionsCell aboveSubview:selectedCell.contentView];
NSLog(@"subviews: %@",selectedCellContentView.subviews);
我面临的挑战是让视野保持在牢房里。取而代之的是视图短暂出现,然后消失。我怎样才能让它停留下来,然后在另一次触摸事件发生后如何让它消失?查看本教程。这就是你要找的吗