geliyor. UIScrollView'a yerleştirilmiş bir metin alanıyla benzer bir sorun yaşadım.
UITextField'ımın üzerine net bir UIView yerleştirerek bu sorunu aştım. Daha sonra, kullanıcı bu alana dokunduğunda metin alanını ilk yanıtlayıcı olarak ayarlamak için bu net görünüme bir UITapGestureRecognizer ataydım. Aksi takdirde, kaydırılan, kaydırmayı herhangi bir sorun olmadan tanıyan ana görünüme (kaydırma görünümü) gönderilir. Bu biraz topal ama işe yarıyor.
Bu senaryo sizinkilerden biraz farklı, ama bence aynı sorun. denetleyicisi sonra
// UIView subclass header
@interface LSAddPageView : UIView
@property (weak, nonatomic) IBOutlet UITextField *textField; // Connected to the UITextField in question
@property (strong, nonatomic) UIView *textFieldMask;
@property (assign, nonatomic) BOOL textFieldMaskEnabled;
@end
// UIView subclass implementation
@implementation LSAddPageView
- (void)awakeFromNib
{
[super awakeFromNib];
_textFieldMask = [UIView new];
_textFieldMask.backgroundColor = [UIColor clearColor];
[self insertSubview:_textFieldMask aboveSubview:self.textField];
}
- (void)layoutSubviews
{
[super layoutSubviews];
_textFieldMask.frame = self.textField.frame;
}
- (BOOL)textFieldMaskEnabled
{
return _textFieldMask.hidden == NO;
}
- (void)setTextFieldMaskEnabled:(BOOL)textFieldMaskEnabled
{
_textFieldMask.hidden = !textFieldMaskEnabled;
}
@end
Ve:
- (void)viewDidLoad
{
[super viewDidLoad];
_addPageView = (LSAddPageView*)self.view;
_maskGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapMask:)];
_maskGestureRecognizer.numberOfTapsRequired = 1;
_maskGestureRecognizer.numberOfTouchesRequired = 1;
[_addPageView.textFieldMask addGestureRecognizer:_maskGestureRecognizer];
self.textField.delegate = self; // Set delegate to be notified when text field resigns first responder
}
- (void)didTapMask:(UIGestureRecognizer*)recognizer
{
_addPageView.textFieldMaskEnabled = NO;
[self.textField becomeFirstResponder];
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
{
_addPageView.textFieldMaskEnabled = YES;
return YES;
}
bu sorunu çözdünüz mü? –
Hayır. Konuyla ilgili arayüzü yeniden tasarladım. –
- (void) tableView eklemeyi deneyin: (UITableView *) tableView commitEditingStyle: (UITableViewCellEditingStyle) editingStyle forRowAtIndexPath: (NSIndexPath *) indexPath. Yalan çekicilik – Lightygalaxy