2011-09-21 28 views

回答

0

使用此delagate - (空)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger的)buttonIndex

你會得到buttonindex在這個委託,你可以調用另一種方法從這裏。

+0

我知道buttonIndex保持索引號碼,但我怎麼能通過這個選定的索引到一個Web服務? –

0

你必須委託教學貫徹法的行動表,

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex(NSInteger)buttonIndex 

在此您可以檢查buttonIndex即0,1,2 ...和你想在選定的索引。

0

您可以使用該方法

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex(NSInteger)buttonIndex 

得到buttonIndex,然後調用從那裏連接到你的Web服務的方法,在buttonIndex作爲參數傳遞。例如:

- (void)methodThatCallsWebservice:(NSInteger)buttonIndex 
{ 
    // however you call the webservice goes here 
} 


-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex(NSInteger)buttonIndex 
{ 
    [self methodThatCallWebservice:buttonIndex]; 
} 
相關問題