In my app for iPhone/iPad (in Objective-C), there are some UITextFields which I am adding progrmatically and these further added to array.
I want to set the hidden property on some button click (where I found the particular UITextField by traversing the array).
When I set the textfilled.hidden = true (at button click event), then it is not hidden instead in disabled mode and if I again set textfilled.hidden = false, then it enables.
I have tried changing other properties like text, background color etc. at the same level all works fine except the hidden property.
Note: If it set textfilled.hidden = true after adding the text field (with the same object of UITextField) then it hides perfectly.
UPDATE: I have used the following code:
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];
In this I am creating a UITextField and adding it to array(noteTextArray) and the calling the .hidden property here:
-(void)handleEnterPressed:(UITextField *)textField
{
for(UITextField *noteText in noteTextArray)
{
if(noteText.tag==textField.tag)
{
noteText.backgroundColor=[UIColor purpleColor];
noteText.text=@"Hi";
noteText.hidden=true;
}
}
}
But it is not hiding the text field.
Please let me know if somebody has any idea or solution.
UPDATE 1: Image has been taken by capturing the screenshot of current view of WebView
UIGraphicsBeginImageContextWithOptions(webview.frame.size,NO,0.0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
[webview.layer renderInContext: context];
capturedImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
And the image further added to 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];
}
Property cannot set as active and deactivate so This will be better approach if u set the property according to the situation like on button 1 pressed
and on button pressed
update:
Update 2:
update 3: please download the sample code (testTextField)