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

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -