1

現在、私のアプリにはジェスチャがあります.UITableViewセルを押したままにすると、セル内のオブジェクトが編集され、セルをタップするとセル内のオブジェクトが表示されます。その部分は問題なく機能しますが、ユーザーが UISearchBar を使用すると、結果テーブルに同じジェスチャがありません。

同じジェスチャを initWithNibName の else セクションに追加する必要がありますか?

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = NSLocalizedString(@"AutoNotes2", @"AutoNotes2");
        if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
            self.clearsSelectionOnViewWillAppear = NO;
            self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
        }
        else {
            UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Concrete.png"]];
            [tempImageView setFrame:self.tableView.frame]; 

            self.tableView.backgroundView = tempImageView;
            self.searchDisplayController.searchResultsTableView.backgroundView = tempImageView;
        }
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap)];

    doubleTap.numberOfTapsRequired = 2;
    [self.view addGestureRecognizer:doubleTap];

    // Two finger, double tap
    UITapGestureRecognizer *twoFingerDoubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerDoubleTap:)];

    twoFingerDoubleTap.numberOfTapsRequired = 1;
    twoFingerDoubleTap.numberOfTouchesRequired = 2;
    [self.tableView addGestureRecognizer:twoFingerDoubleTap];


    UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
    lpgr.minimumPressDuration = 1.0; //seconds
    //lpgr.delegate = self;
    [self.tableView addGestureRecognizer:lpgr];

}
4

0 に答える 0