简体   繁体   中英

UItextView hide in UIScrollview on tap

I have an UIScrollView (with 40+ pages) with UITextview added as subview on every page. What i want to do is that on single tap, i want to hide the UITextField on all pages? How should I do it? I am trying to do like this in hadle tap method:

textview.hidden = YES;

But it is hiding text view only on last page, not on all pages.

Any help is appreciated

You can do, instead of textview.hidden = YES; the following:

for(id object in objScrollView.subviews)
{
    if([object isKindOfClass:[UITextView class]])
    {
        UITextView *tmpObj= (UITextView *)object;
        [tmpObj setHidden:!tmpObj.hidden];
    }
}

Put the above code in tap method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM