iphone程式開發 alert使用
iphone上很常見的警告視窗 如何使用呢 UIAlertView *alert=[[ UIAlertView alloc ] initWithTitle : @"Alert!" message : @"Here is an alert message!" delegate : self cancelButtonTitle : @"OK" otherButtonTitles : nil ] ; [alert show ]; [alert release ]; 要加入多個按鈕則使用"otherButtonTitles達成" UIAlertView *alert = [[[ UIAlertView alloc ] initWithTitle : @"alert" message : @"Here is an alert message!" delegate : self cancelButtonTitle : @"1" otherButtonTitles : @" 2" , @" 3" , nil ] autorelease ]; [alert show ]; 執行如下 按下確定後的處理函式 可以透過delegate指派來達成 多個按鍵 會回傳buttonIndex 從0開始 然後再m檔裡實作 - ( void )alertView:( UIAlertView *)alertView didDismissWithButtonIndex:( NSInteger )buttonIndex { if (buttonIndex == 0 ) { // and they clicked 1. NSLog ( @"1 clicked" ); } else if (buttonIndex== 1 ){ NSLog ( @"2 clicked" ); } else if (buttonInd...