Я создаю окно с предупреждением о регистрации, в котором есть UITextField, в котором пользователь может ввести свой регистрационный номер. все в значительной степени их,однако я хотел бы программно удалить функцию копирования и вставки из текстового поля, так как это не версия текстового поля InterfaceBuilder. Я понятия не имею, как это сделать ..
Вот мой UIalertview до сих пор ...
- (void)pleaseRegisterDevice {
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Please Register Device!" message:@"this gets covered" delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
regTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
[regTextField setBackgroundColor:[UIColor whiteColor]];
regTextField.textAlignment = UITextAlignmentCenter;
[myAlertView addSubview:regTextField];
[myAlertView show];
[myAlertView release];
}
Быстро 5 решений:
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
if action == #selector(UIResponderStandardEditActions.copy(_:)) || action == #selector(UIResponderStandardEditActions.paste(_:)) {
return false
}
return true
}