2012-12-10 1 views
3

이상한 문제가 있습니다. 내가 시뮬레이터에 내 애플 리케이션을 실행할 때 모든게 잘 작동하지만 일부 코드는 어쨌든 응답하지 않습니다 .. !! 나는 UIActionSheet를 시뮬레이터에서 잘하는 것 같지만, On 장치는 전혀 작동하지 않는다. 심지어 UIAction 시트가 iPad에서는 작동하지 않지만 시뮬레이터에서 작동

가 여기에 액션 시트 보여 내 코드입니다 .. 아이팟 작업 :

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{ 
if ([actionSheet buttonTitleAtIndex:buttonIndex] == @"A") {....} 
if ([actionSheet buttonTitleAtIndex:buttonIndex] == @"B") {....} 
} 

친구가 당신의 도움을 찾고 메신저 액션 시트이 대리자를 사용하여

UIActionSheet *DeleteAction = [[UIActionSheet alloc] initWithTitle:@"Select Delete Option" delegate:self cancelButtonTitle:Nil destructiveButtonTitle:nil otherButtonTitles:nil, nil]; 
[DeleteAction addButtonWithTitle:@"A"]; 
[DeleteAction addButtonWithTitle:@"B"]; 
[DeleteAction showInView:self.view]; 

및 메신저를 .. . 미리 감사드립니다. 아미타이

+1

먼저 iPad에서 응용 프로그램을 삭제하고 Xcode를 사용하여 다시 설치해보십시오. –

+0

행운을 빌어 요 .... – Amitabha

답변

2

나는이 코드를 사용하여 잘 작동합니다. 알려주세요. 작업 표를 보여 주 었는지의 여부

-(void)share { 
    UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"cancel" destructiveButtonTitle:nil otherButtonTitles:@"Email this Info",@"Tweet this Info",@"Share On Facebook", nil]; 
    popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque; 
    [popupQuery showInView:self.view]; 
    [popupQuery release]; 
} 

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 
    if (buttonIndex == 0) { 
     [self emailinfo]; 
    } 
    if (buttonIndex == 1) { 
     [self tweetinfo]; 
    } 
    if (buttonIndex == 2) { 
     [self shareonfacebook]; 
    } 
    if (buttonIndex == 3) { 

    } 
} 
+0

actionSheet이 (가) 표시되지만 관련 Delegate가 응답하지 않습니다. – Amitabha

+0

sri - Ive는 ur 코드를 시도했지만 .. 운이 없다 .. !! 같은 문제가 .. – Amitabha

+0

시도해보십시오. ([[actionSheet buttonTitleAtIndex : buttonIndex] isEqual : @ "A"]) { } – sri

2

문제가 해결되었습니다.

if ([[actionSheet buttonTitleAtIndex:buttonIndex]isEqualToString: @"A"]) {....}