ios - WebView is removed from View when it's subview's tag is zero -
my code has bunch of buttons added webview.scrollview of them has different tags when try remove 1 tag number 0 web view removed view.
when add web view self.view set web view's tag webview.tag=121212; , webview.scrollview.tag=121211;
then call
- (void)removebuttonfromscrollview:(nsinteger)butontag { [(uibutton*)[webview.scrollview viewwithtag:butontag] removefromsuperview]; } how can make sure button removed web view, not web view itself.
do not use tag 0 value. if generating tags, save them somewhere check later.
for example can nsmutableset, can contain unique value. or try view tag.
if ([self.view viewwithtag:tag]) { // don't use it, generate 1 }
Comments
Post a Comment