出于某种原因,我似乎无法在不删除所有 UIButton 的情况下删除 UIImageView。所有子视图都添加到我的主视图 _ourView 和 UIButtons 没有被赋予标签(默认 0),我的图像被赋予标签 = 5。
当我打电话
NSInteger o = [obj intValue]; //This is the letter "O" not 0, and o = 5 in this case (which is what my subview tag is)
UIView *hangmanView = [_ourView viewWithTag:o];
[hangmanView removeFromSuperview];
[_ourView setNeedsDisplay];
我所有的按钮也消失了。
任何指针?
编辑:如果您想查看更多代码,我已将我的项目上传到 github。这是文件的链接:https ://github.com/elayman/Hangman/blob/master/Hangman/HangmanViewController.m#L172