ubicacion segun puedo para localizacion descargar cómo como actualizar actual activar ipad ios8 uipopovercontroller uiactionsheet uialertcontroller

ipad - segun - Cambiar la hoja de acción de la flecha emergente en iOS8



ios 8.0 iphone 4 (4)

Estoy usando UIAlertController . Pero en iPad con iOS 8, actionSheet se muestra con una flecha emergente. ¿Alguna idea para esconder esa flecha?

Aquí está mi código:

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"this is alert controller" message:@"yeah" preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel action") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { NSLog(@"Cancel action"); }]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK action") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"OK action"); }]; UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Delete", @"Delete action") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { NSLog(@"Delete action"); }]; [alertController addAction:cancelAction]; [alertController addAction:okAction]; [alertController addAction:deleteAction]; UIPopoverPresentationController *popover = alertController.popoverPresentationController; if (popover) { popover.sourceView = self.view; popover.sourceRect = self.view.bounds; popover.permittedArrowDirections = UIPopoverArrowDirectionUnknown; } [self presentViewController:alertController animated:YES completion:nil];


Estás en el camino equivocado al usar UIPopoverPresentationController para mostrar una alerta. Simplemente no necesitas ese código cortado ...

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"this is alert controller" message:@"yeah" preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel action") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { NSLog(@"Cancel action"); }]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"OK", @"OK action") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"OK action"); }]; UIAlertAction *deleteAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Delete", @"Delete action") style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { NSLog(@"Delete action"); }]; [alertController addAction:cancelAction]; [alertController addAction:okAction]; [alertController addAction:deleteAction]; [self presentViewController:alertController animated:YES completion:nil];


La respuesta de Jageen, en Swift:

popoverController.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0)


La respuesta seleccionada no centra la alerta si tiene una barra de navegación / estado. Para centrar exactamente su controlador de alerta:

alertController.popoverPresentationController.sourceRect = [self sourceRectForCenteredAlertController]; alertController.popoverPresentationController.sourceView = self.view; alertController.popoverPresentationController.permittedArrowDirections = 0;

Con el método de conveniencia:

- (CGRect)sourceRectForCenteredAlertController { CGRect sourceRect = CGRectZero; sourceRect.origin.x = CGRectGetMidX(self.view.bounds)-self.view.frame.origin.x/2.0; sourceRect.origin.y = CGRectGetMidY(self.view.bounds)-self.view.frame.origin.y/2.0; return sourceRect; }

Además, el controlador de alertas no permanece centrado si se gira la vista. Para mantener centrado el controlador de alertas, debe actualizar sourceRect después de la rotación. Por ejemplo:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { // Check if your alert controller is still being presented if (alertController.presentingViewController) { alertController.popoverPresentationController.sourceRect = [self sourceRectForCenteredAlertController]; } }

O, si no desea usar eventos de rotación, puede usar el método de delegado popoverPresentationController para reposicionar la popoverPresentationController :

- (void)popoverPresentationController:(UIPopoverPresentationController *)popoverPresentationController willRepositionPopoverToRect:(inout CGRect *)rect inView:(inout UIView *__autoreleasing _Nonnull *)view { // Re-center with new rect }


Solución:
use below line for remove arrow from action sheet

[yourAlertController.popoverPresentationController setPermittedArrowDirections:0];


Muestra

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Test Action Sheet" message:@"Message" preferredStyle:UIAlertControllerStyleActionSheet]; UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { NSLog(@"Cancel action"); }]; UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"OK action"); }]; UIAlertAction *otherAction = [UIAlertAction actionWithTitle:@"Other" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { NSLog(@"Otheraction"); }]; [alertController addAction:okAction]; [alertController addAction:otherAction]; [alertController addAction:cancelAction]; // Remove arrow from action sheet. [alertController.popoverPresentationController setPermittedArrowDirections:0]; //For set action sheet to middle of view. alertController.popoverPresentationController.sourceView = self.view; alertController.popoverPresentationController.sourceRect = self.view.bounds; [self presentViewController:alertController animated:YES completion:nil];

Salida