if( [selfviewWithTag:789] ){ //如果tag爲789的視圖存在
[[selfviewWithTag:789]removeFromSuperview];
}
具體有待研究
官方對 viewWithTag 的解釋是這樣的
Returns the view whose tag matches the specified value. |
|
This method searches the current view and all of its subviews for the specified view. |
在這裏也順便說一下,每個視圖都可以設置tag 不僅僅包括Button 還有 view imageview等等
返回其標記匹配指定值的視圖。
此方法搜索當前視圖及其所有子視圖指定的視圖。