預設按鈕

實作
[xcode]
– (IBAction)openMethod:(id)sender {
UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"標題"
delegate:nil
cancelButtonTitle:@"取消"
destructiveButtonTitle:@"刪除"
otherButtonTitles: nil];
[action showInView:self.view];
}
[/xcode]

設計為兩個按鈕

實作
[xcode]
– (IBAction)saveMethod:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"標題"
message:@"文字內容"
delegate:nil
cancelButtonTitle:@"取消"
otherButtonTitles:@"儲存", nil];
[alert show];
}
[/xcode]

設計為三個按鈕

實作
[xcode]
– (IBAction)saveMethod:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"標題"
message:@"文字內容"
delegate:nil
cancelButtonTitle:@"取消"
otherButtonTitles:@"儲存", @"另儲新檔", nil];
[alert show];
}
[/xcode]

將otherButton設計為四個按鈕(共五個)

實作
[xcode]
– (IBAction)saveMethod:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"標題"
message:@"文字內容"
delegate:nil
cancelButtonTitle:@"取消"
otherButtonTitles:@"儲存", @"另儲新檔", @"另儲新檔1", @"另儲新檔2", nil];
[alert show];
}
[/xcode]

將otherButton設計為五個按鈕(共六個)

實作
[xcode]
– (IBAction)saveMethod:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"標題"
message:@"文字內容"
delegate:nil
cancelButtonTitle:@"取消"
otherButtonTitles:@"儲存", @"另儲新檔", @"另儲新檔1", @"另儲新檔2", @"另儲新檔3", nil];
[alert show];
}
[/xcode]

廣告