2011-02-24 4 views

답변

7

은 액션 시트에 이름이나 태그를 설정하고이

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex 
{ 
    if(actionSheet==yourActionsheet1) 
    { 
     //your logic 
     } 
    if(actionSheet==yourActionsheet2) 
    { 
     //your logic 
     } 
    } 

희망처럼 당신은 다음과 같이 여러 액션 시트를 만들 수 있습니다 도움말

+0

감사합니다. 버튼 색상을 설정하는 방법을 알고 있습니까? 예 : 빨간색 삭제 버튼? – jarryd

+1

@ Helium3 : 빨간색은 기본적으로 작업 시트에있는 파괴적인 버튼 제목의 색상입니다. 당신은 액션 시트를 선언하는 동안'destructiveButtonTitle = @ "Delete"를 선언해야합니다. 희망이 당신을 도와줍니다. –

+0

예, 감사합니다. ;) – jarryd

2

여러보기를 동일한보기 컨트롤러에 추가 할 수 있습니다. 각 작업 시트에 태그를 설정하고 위임 메서드에서 태그를 확인하여 필요한 기능을 수행 할 수 있습니다.

3

어떤 일을 :

actionSheet1 = [[UIActionSheet alloc] initWithTitle:@"Where to go" 
                delegate:self 
              cancelButtonTitle:@"cancel" 
            destructiveButtonTitle:@"Store 2" 
              otherButtonTitles:@"Store 3",@"Store 4",@"Store 5",@"View Store Profile",nil]; 
actionSheet2 = [[UIActionSheet alloc] initWithTitle:@"Where to go" 
                delegate:self 
              cancelButtonTitle:@"cancel" 
            destructiveButtonTitle:@"Store 1" 
              otherButtonTitles:@"Store 3",@"Store 4",@"Store 5",@"View Store Profile",nil]; 
actionSheet3 = [[UIActionSheet alloc] initWithTitle:@"Where to go" 
                delegate:self 
              cancelButtonTitle:@"cancel" 
            destructiveButtonTitle:@"Store 1" 
              otherButtonTitles:@"Store 2",@"Store 4",@"Store 5",@"View Store Profile",nil]; 

&을 그 다음에 어떤 액션 시트가 호출되는지 확인하십시오. - (void) actionSheet : (UIActionSheet *) actionSheet didDismissWithButtonIndex : (NSInteger) buttonIndex {

if(actionSheet==actionSheet1) 
{ 
} 
else if(actionSheet==actionSheet2) 
{ 
} 
else if(actionSheet==actionSheet3) 
{ 
} 
관련 문제