1

我正在尝试重新创建在许多应用程序中看到的效果,您有一个带有单元格的表格视图,在单元格上滑动,该视图被另一个包含其他按钮的视图替换。

我试图这样做如下:

    // 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);

我面临的挑战是让视野留在牢房上。取而代之的是视图短暂出现然后消失。我怎样才能让它留下来,然后一旦发生另一个触摸事件,我怎样才能让它消失呢?

4

1 回答 1

2

看看这个教程。那是你要找的吗?

http://idevrecipes.com/2011/04/14/how-does-the-twitter-iphone-app-implement-side-swiping-on-a-table/

于 2013-04-04T02:05:17.230 回答