SORU
14 HAZİRAN 2014, CUMARTESİ


Bir UİAlertController düzgün bir iPad kullanarak zararlı, iOS 8

İOS 8.0, Elma UIAlertController UIActionSheet yerine getirmiştir. Ne yazık ki, Apple sunulacağı konusunda herhangi bir bilgi çıkmadı. HayaGeek bu blog hakkında entry, ancak, iPad üzerinde çalışmak için görünmüyor bir buldum. Görünümü tamamen yersiz

Yanlış: Misplaced image

Doğru: enter image description here

Aşağıdaki kod arayüzü üzerinde göstermek için kullanın:

    let alert = UIAlertController()
    // setting buttons
    self.presentModalViewController(alert, animated: true)

İPad için eklemek için başka bir yol var mı? Ya da Apple iPad, ya da uygulanan değil, henüz unuttun?

CEVAP
15 HAZİRAN 2014, Pazar


UIPopoverPresentationController kullanarak bir popover UIAlertController hediye edebilirsiniz.

N-C: İçinde

UIViewController *self; // code assumes you're in a view controller
UIButton *button; // the button you want to show the popup sheet from

UIAlertController *alertController;
UIAlertAction *destroyAction;
UIAlertAction *otherAction;

alertController = [UIAlertController alertControllerWithTitle:nil
                                                      message:nil
                           preferredStyle:UIAlertControllerStyleActionSheet];
destroyAction = [UIAlertAction actionWithTitle:@"Remove All Data"
                                         style:UIAlertActionStyleDestructive
                                       handler:^(UIAlertAction *action) {
                                           // do destructive stuff here
                                       }];
otherAction = [UIAlertAction actionWithTitle:@"Blah"
                                       style:UIAlertActionStyleDefault
                                     handler:^(UIAlertAction *action) {
                                         // do something here
                                     }];
// note: you can control the order buttons are shown, unlike UIActionSheet
[alertController addAction:destroyAction];
[alertController addAction:otherAction];
[alertController setModalPresentationStyle:UIModalPresentationPopover];

UIPopoverPresentationController *popPresenter = [alertController 
                                              popoverPresentationController];
popPresenter.sourceView = button;
popPresenter.sourceRect = button.bounds;
[self presentViewController:alertController animated:YES completion:nil];

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • ☆ SUB4SUB CENTER! ☆ spam here

    ☆ SUB4SUB

    22 ŞUBAT 2010
  • eisleyhead

    eisleyhead

    11 Ocak 2006
  • Gavin Hoey

    Gavin Hoey

    21 Aralık 2007