How to customize / style a UIPopoverController

This is possible starting in iOS 5.0 by subclassing the abstract class UIPopoverBackgroundView and assigning your subclass to the popoverBackgroundViewClass property on your UIPopoverController instance. Unfortunately there is no tintColor property as the popover needs to use images for it’s arrow and border in order to achieve smooth animations during dynamic resizing. You can learn … Read more

How to correctly present a popover from a UITableViewCell with UIPopoverArrowDirectionRight or UIPopoverArrowDirectionLeft

You’re getting the frame from the cell via the rectForRowAtIndexPath method. This is correct. However the tableview is most likely a subview of a larger iPad view so when the popover gets the coordinates it thinks they’re in the larger view. This is why the popover appears in the wrong place. Example, the CGRect for … Read more

UIPopoverController for iphone not working?

You CAN use popoverController in iPhone apps. 1. Create a category // UIPopoverController+iPhone.h file @interface UIPopoverController (iPhone) + (BOOL)_popoversDisabled; @end // UIPopoverController+iPhone.m file @implementation UIPopoverController (iPhone) + (BOOL)_popoversDisabled { return NO; } @end 2. Import it to your class and use popover in iPhone as usual. But remember that this is private method and Apple … Read more

UIAlertController is Crashed (iPad)

To keep it device independent, rather use it as shown in the snippet below. This code will return nil for popoverPresentationController on an iPhone / compact size device, so you can safely use it in universal projects. if let popoverPresentationController = shareMenu.popoverPresentationController { popoverPresentationController.sourceView = self.view popoverPresentationController.sourceRect = sender.bounds } self.presentViewController(shareMenu, animated: true, completion: nil)

how to center a popoverview in swift

You need to provide the source rect for the popover. From the apple documentation: the source rect is the rectangle in the specified view in which to anchor the popover. Use this property in conjunction with the sourceView property to specify the anchor location for the popover. In your case, under _popoverPresentationController.sourceView = self.view; add: … Read more

Source type 1 not available

This is because you are opening a camera on the simulator(or on a device not having camera)… since the code is something like [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] and obviously, the simulator doesn’t have a camera… Proceed giving an alert like this, if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@”Error” message:@”Device has no camera.” delegate:nil cancelButtonTitle:@”OK” … Read more

Popovers cannot be presented from a view which does not have a window

the thing that saved my life: if (self.view.window != nil) [popoverController presentPopoverFromRect:CGRectMake(44, yCoord, 111, 111) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; by adding if condition it doesn´t crash anymore. I don´t really get it because the presentPopoverFromRect function is ALWAYS called. There is no situation where window would be nil but anyway it did the trick. edit: I … Read more

How can I fix the “UIPopoverController is deprecated” warning?

You no longer need UIPopoverController for presenting a view controller. Instead you can set the modalPresentationStyle of view controller to UIModalPresentationPopover. You can use the following code for that: avc.modalPresentationStyle = UIModalPresentationPopover; avc.popoverPresentationController.sourceView = theButton; [self presentViewController:avc animated:YES completion:nil]; UIModalPresentationPopover In a horizontally regular environment, a presentation style where the content is displayed in a … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)