-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIPopoverController+Singleton.m
37 lines (29 loc) · 1.47 KB
/
UIPopoverController+Singleton.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// UIPopoverControllerSingle.m
// houzz
//
// Created by Guy Shaviv on 4/4/10.
// Copyright 2010 Tiv Studio. All rights reserved.
//
// License: You can use this source code freely provided you keep this notice any time you distribute this as source.
// Distribution as binary is permitted. An attribution would be nice but not essential.
#import "UIPopoverController+Singleton.h"
static UIPopoverController *visibleController;
@implementation PopoverController
+ (void) presentPopover:(UIPopoverController*)popoverController fromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated {
[popoverController presentPopoverFromBarButtonItem:item permittedArrowDirections:arrowDirections animated:animated];
visibleController = popoverController;
}
+ (void) presentPopover:(UIPopoverController*)popoverController fromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated {
[popoverController presentPopoverFromRect:rect inView:view permittedArrowDirections:arrowDirections animated:animated];
visibleController = popoverController;
}
+ (UIPopoverController*) visibleController {
if (visibleController && [visibleController isKindOfClass:[UIPopoverController class]] && [visibleController isPopoverVisible]) {
return visibleController;
} else {
visibleController = nil;
}
return nil;
}
@end