以下のように、ViewController の viewDidLoad メソッドで初期化された LongPress ジェスチャ レコグナイザがあります。
longPressGesture_= [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(displayTimeFlagCallout)];
ビューコントローラーにテーブルビューがあります。テーブルビューにはカスタム セルがあります。各セルには 2 つのテキストフィールドがあります。ユーザーがテキスト フィールド (startTime と endTime) を長押ししたときに、カスタム ポップオーバーを表示したいと考えています。拡大鏡とコピー/貼り付けポップオーバーが標準の動作としてテキストフィールドを長押ししたときに表示されないようにしたいため、ジェスチャ認識機能を追加する前に、テキストフィールドの組み込みの長押しジェスチャ認識機能を無効にしています。cellforRowAtIndexPath メソッドに次のコードを追加しました。
MyCustomCell_iPhone *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil)
{
cell = [[MyCustomCell_iPhone alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
for (UIGestureRecognizer *recognizer in cell.startTime.gestureRecognizers) {
if ([recognizer isKindOfClass:[UILongPressGestureRecognizer class]]){
recognizer.enabled = NO;
}
}
for (UIGestureRecognizer *recognizer in cell.endTime.gestureRecognizers) {
if ([recognizer isKindOfClass:[UILongPressGestureRecognizer class]]){
recognizer.enabled = NO;
}
}
[cell.startTime addGestureRecognizer:longPressGesture_];
[cell.endTime addGestureRecognizer:longPressGesture_];
}
ただし、これは機能していません。現在、長押ししても何も起こりません。何が問題になる可能性がありますか?
ありがとうヘタル