我創建的UIAlertcontroller
兩個按鈕:創建行動,當我點擊一個按鈕比UIAlertcontroller
One Button - "OpenCamera"
Two button - "OpenGallery"
我只是不明白我是如何創建的行動,當我點擊其中的一個。
- (IBAction)takePic:(id)sender {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil
message:nil
preferredStyle:UIAlertControllerStyleActionSheet]; // 1
UIAlertAction *openCamrea = [UIAlertAction actionWithTitle:@"open camrea"
style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
}];
UIAlertAction *openGallery = [UIAlertAction actionWithTitle:@"open gallery"
style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
}];
[alert addAction:openCamrea];
[alert addAction:openGallery];
[self presentViewController:alert animated:YES completion:nil];
}
'處理程序:^(UIAlertAction *動作){//代碼按下按鈕時的操作}];'?或者是你不知道如何打開相機或如何打開畫廊? – Larme