怎么判断一个View1的祖父View是View4?
比如有5个View, View1, View2, View3, View4.
view1的父view是View2, view2的父view是view3,view3的父view是view4
怎么判断view1是包含在view4里的?
view1.superView.superView.superView == view4 ?
但假如隔离几代是不知道的。我只想知道view1是否包含在某个view中,不管隔了几代,该怎么判断?
[解决办法]
View *view = view1;
bool find = NO;
while (view != nil && !(find = (view.superView == view4)))
{
view = view.superView;
}
[解决办法]