В моем приложении для iPhone / iPad (в Objective-C) есть некоторые UITextFields
, которые я добавляю программно, а затем они добавляются в массив.
Я хочу установить свойство hidden
для какого-нибудь нажатия кнопки (где я нашел конкретный UITextField
путем обхода массива).
Когда я устанавливаю textfilled.hidden = true
(при событии нажатия кнопки), он не скрывается вместо этого в отключенном режиме, и если я снова устанавливаю textfilled.hidden = false
, он включается.
Я попытался изменить другие свойства, такие как текст, цвет фона и т. Д. На том же уровне, все работает нормально, кроме скрытого свойства.
Примечание. Если после добавления текстового поля установлено значение textfilled.hidden = true
(с тем же объектом UITextField
), то оно отлично скрывается.
ОБНОВЛЕНИЕ: Я использовал следующий код:
UITextField *textField=[[[UITextField alloc] initWithFrame:CGRectMake(lastPoint.x, lastPoint.y, 60, 20)] autorelease];
textField.backgroundColor=[UIColor greenColor];
textField.textColor=[UIColor blackColor];
[textField addTarget:self action:@selector(handleEnterPressed:) forControlEvents:UIControlEventEditingDidEndOnExit];
[capturedImage addSubview:textField];
[noteTextArray addObject:textField];
В этом я создаю UITextField и добавляю его в массив (noteTextArray) и вызываю свойство .hidden здесь:
-(void)handleEnterPressed:(UITextField *)textField
{
for(UITextField *noteText in noteTextArray)
{
if(noteText.tag==textField.tag)
{
noteText.backgroundColor=[UIColor purpleColor];
noteText.text=@"Hi";
noteText.hidden=true;
}
}
}
Но оно не скрывает текстовое поле.
Пожалуйста, дайте мне знать, если у кого-то есть идея или решение.
ОБНОВЛЕНИЕ 1: изображение было снято путем захвата скриншота текущего представления WebView
UIGraphicsBeginImageContextWithOptions(webview.frame.size,NO,0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
[webview.layer renderInContext: context];
capturedImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
И изображение, добавленное в uiscrollviewer:
scrollViewer.delegate=self;
scrollViewer.contentOffset = CGPointZero;
capturedImage.contentMode= UIViewContentModeScaleAspectFit;
scrollViewer.userInteractionEnabled=true;
scrollViewer.contentMode= UIViewContentModeScaleAspectFit;
scrollViewer.scrollEnabled=YES;
[scrollViewer setBouncesZoom:YES];
scrollViewer.clipsToBounds= YES;
scrollViewer.contentSize = capturedImage.image.size;
scrollViewer.minimumZoomScale=0.1;
scrollViewer.maximumZoomScale=5.0;
scrollViewer.zoomScale=0.5;
if(capturedImage.superview != scrollViewer)
{
[scrollViewer addSubview:capturedImage];
}