2013-08-12 2 views
3

UIViewController에서 UITabbar를 만들었습니다. 그런 다음 UIActionSheet를 추가했지만 액션 시트가 나타나면 "Cancel"버튼의 상단 부분을 클릭하면 작동하지만 "Cancel"의 맨 아래 부분을 클릭해도 응답이 없습니다.iOS의 UITabbarcontroller에서 작업 시트 추가

Presenting action sheet clipped by its superview. Some controls might not respond to touches. On iPhone try -[UIActionSheet showFromTabBar:] or -[UIActionSheet showFromToolbar:] instead of -[UIActionSheet showInView:]. 

당신이 어떤 제안이 있습니까 : 나는 액션 시트를 클릭하면

actionSheetDelete = [[UIActionSheet alloc] initWithTitle:@"Do you want to continue?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete Item(s)" otherButtonTitles:nil]; 
actionSheetDelete.actionSheetStyle = UIActionSheetStyleBlackOpaque; 
[actionSheetDelete showInView:self.view]; 
[actionSheetDelete release]; 

, 난 항상 콘솔에서이 경고를 보여 나는 actionsheet를 추가하려면이 코드를 사용? 미리 감사는

+0

내 대답보기 ... –

+0

[UIActionSheet보기를 Tab Bar Controller 위에 표시하는 방법?] (http://stackoverflow.com/questions/2774270/how-to-display-the-uiactionsheet- view-from-above-tab-bar-controller) – Raptor

답변

1

당신은 UITabBarController가의보기에서 보여줄 수는 :

actionSheetDelete = [[UIActionSheet alloc] initWithTitle:@"Do you want to continue?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete Item(s)" otherButtonTitles:nil]; 
actionSheetDelete.actionSheetStyle = UIActionSheetStyleBlackOpaque; 
[actionSheetDelete showInView:self.tabBarController.view]; 
[actionSheetDelete release]; 

또는 약간 더 강력한 버전이 될 수 있습니다

[actionSheetDelete showInView:[UIApplication sharedApplication].keyWindow]; 
+0

'UIActionSheet'의'showFromTabBar'는'UITabbar'와 함께 동작하도록 설계되었습니다 – Raptor

+0

네, 어쨌든 나는'showInView : [UIApplication sharedApplication] .keyWindow' 방식을 선호합니다. 이 방법으로 내 View Controller는 그것이 'UITabBarController'에 표시되는지 알 필요가 없습니다. –

+0

이것은 적절한 방법이 아닙니다 ... 내 대답을 확인하십시오. –

2

시도 :

[actionSheetDelete showFromTabBar:self.tabBarController.tabBar]; 
+0

나는 당신의 코드를 시도했지만 errr을 보여줍니다 : 어설 션 오류 - [UIActionSheet _presentSheetFromView : above :], /SourceCache/UIKit_Sim/UIKit-2380.17/UIActionSheet.m:1778 2013-08-12 14:34 : 37.905 Cloudstringers [4253 : c07] *** 캐치되지 않은 예외 'NSInternalInconsistencyException'으로 인해 앱 종료 중, 이유 : '유효하지 않은 매개 변수가 잘못됨 :보기! = nil' – user2669713

0

보기 자체에서 작업 시트를 표시하려고합니다. 뷰 내부에 UITabBarController가 이미있는 것을 고려하면이 작업을 수행 할 수 없습니다. 따라서 표시 될 때 탭 표시 줄에서 설정해야합니다. 이렇게하면 단추가 탭 막대보기 아래로로드되지 않으며 탭 막대와 관련된 모든 동작을 사용할 수 있습니다.

따라서 탭 표시 줄 작업 시트이 도움이 희망 표시되는 위치의 초기 위치는 다음과

[actionSheetDelete showFromTabBar:]; 

이렇게 사용한다!