1
UIActionSheet
이 있는지 확인하는 방법 View Hierarchy
에 있습니까? 또한 UIActionSheet
, 좋은 아이디어에 대한 참조를 받고 싶습니까?뷰 계층 구조에 UIActionSheet가 있는지 확인하는 방법은 무엇입니까?
UIActionSheet
이 있는지 확인하는 방법 View Hierarchy
에 있습니까? 또한 UIActionSheet
, 좋은 아이디어에 대한 참조를 받고 싶습니까?뷰 계층 구조에 UIActionSheet가 있는지 확인하는 방법은 무엇입니까?
iOS6에서는 UIActionSheet를 찾기 위해 재귀 검색이 필요합니다. UIWindow의 직접 하위보기가 아닙니다.
static UIView *actionSheet = nil;
-(void)findActionSheetInSubviewsOfView:(id)view
{
if (actionSheet) {
return;
}
if ([[view valueForKey:@"subviews"] count] != 0) {
for (id subview in [view valueForKey:@"subviews"]) {
if ([subview isKindOfClass:[UIActionSheet class]]) {
actionSheet = subview;
}
else
[self findActionSheetInSubviewsOfView:subview];
}
}
}
-(UIActionSheet*) actionSheetShowing {
actionSheet = nil;
for (UIWindow* window in [UIApplication sharedApplication].windows) {
[self findActionSheetInSubviewsOfView:window];
}
if (actionSheet) {
return (UIActionSheet*)actionSheet;
}
return nil;
}
좋은데 ... 괜찮습니다. 감사. – Tarun
태그를 사용하여 액션 시트를 만들고 위임자를 구현하십시오. –
가능한 복제본 : http://stackoverflow.com/questions/4363317/iphone-detecting-if-a-uialert-uiactionsheet-are-open, 두 번째 대답을보십시오 –
@RoxDorentus 중복,하지만 내 문제를 해결, 고마워. – CarmeloS