私は一度..私は、カスタムアクションを作成するカスタムボタンとクリアボタンを交換すること。これ
UISearchBar *searchBar = yourSearchController.searchBar;
UITextField *searchtextfield = [searchBar.subviews objectAtIndex:1];
UIButton *cButton = [UIButton buttonWithType:UIButtonTypeCustom];
cButton.frame = CGRectMake(0, 0, 20 , 20);
cButton.backgroundColor = [UIColor clearColor];
[cButton setImage:[UIImage newImageFromResource:@"yourButtonImage"] forState:UIControlStateNormal];//your button image.
cButton.contentMode = UIViewContentModeScaleToFill;
[cButton addTarget:self action:@selector(customButtonPressed) forControlEvents:UIControlEventTouchUpInside];//This is the custom event
[searchtextfield setRightView:cButton];
[searchtextfield setRightViewMode:UITextFieldViewModeAlways];
幸運をチェックしてくださいました。
実際にはキャンセルボタンではなくクリアボタンを意味していました。 これは、検索フィールドの右側にある小さなボタンについて説明しています。 クリアボタンと言う質問を編集しました。しかし、時間をとっていただきありがとうございます。 –
ええええええええええええええええええええええええええええええんかんかんかんこう: –
明瞭にするために画像を更新しました; –