@@ -39,6 +39,7 @@ @interface YALContextMenuTableView ()
3939@property (nonatomic , strong ) UITableViewCell<YALContextMenuCell> *selectedCell;
4040@property (nonatomic , strong ) NSIndexPath *dismissalIndexpath;
4141@property (nonatomic ) AnimatingState animatingState;
42+ @property (nonatomic , strong ) UIWindow *window;
4243
4344@end
4445
@@ -64,15 +65,22 @@ - (instancetype)init {
6465 self.menuItemsSide = Right;
6566 self.menuItemsAppearanceDirection = FromTopToBottom;
6667
67- self.backgroundColor = [[UIColor blackColor ] colorWithAlphaComponent: 0 .7f ];
68+ self.window = [[UIWindow alloc ] init ];
69+ self.window .windowLevel = UIWindowLevelStatusBar + 1 .0f ;
70+ self.window .backgroundColor = [[UIColor blackColor ] colorWithAlphaComponent: 0 .7f ];
71+ self.frame = self.window .frame ;
72+
73+ // self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.7f];
74+ self.backgroundColor = [UIColor clearColor ];
6875 self.separatorColor = [UIColor colorWithRed: 181.0 /255.0 green: 181.0 /255.0 blue: 181.0 /255.0 alpha: 0 ];
6976 self.tableFooterView = [[UIView alloc ] initWithFrame: CGRectZero]; // Zero rect footer to clear empty rows UITableView draws
77+ // [self.window addSubview:self];
7078 }
7179 return self;
7280}
7381
7482#pragma mark - Show / Dismiss
75- - (void )showInView : (UIView *) superview withEdgeInsets : (UIEdgeInsets) edgeInsets animated : ( BOOL )animated {
83+ - (void )showWithAnimated : ( BOOL )animated {
7684 if (self.animatingState !=Stable) {
7785 return ;
7886 }
@@ -83,16 +91,17 @@ - (void)showInView:(UIView *)superview withEdgeInsets:(UIEdgeInsets)edgeInsets a
8391
8492 self.dismissalIndexpath = nil ;
8593
86- [superview addSubViewiew: self withSidesConstrainsInsets: edgeInsets];
94+ [self .window addSubview: self ];
95+ self.window .hidden = NO ;
8796
8897 if (animated) {
8998 self.animatingState = Showing;
90- self.alpha = 0 ;
99+ self.window . alpha = 0 ;
91100
92101 [self setUserInteractionEnabled: NO ];
93102
94103 [UIView animateWithDuration: self .animationDuration animations: ^{
95- self.alpha = 1 ;
104+ self.window . alpha = 1 ;
96105 } completion: ^(BOOL finished) {
97106 [self show: YES visibleCellsAnimated: YES ];
98107 [self setUserInteractionEnabled: YES ];
@@ -231,6 +240,7 @@ - (void)dismissSelf {
231240 BOOL clockwise = self.menuItemsSide == Right ? NO : YES ;
232241 [self show: NO cell: self .selectedCell animated: YES direction: direction clockwise: clockwise completion: ^(BOOL completed) {
233242 [self removeFromSuperview ];
243+ self.window .hidden = YES ;
234244 if ([self .yalDelegate respondsToSelector: @selector (contextMenuTableView:didDismissWithIndexPath: )]) {
235245 [self .yalDelegate contextMenuTableView: self didDismissWithIndexPath: [self indexPathForCell: self .selectedCell]];
236246 }
@@ -248,7 +258,7 @@ - (void)shouldDismissSelf {
248258
249259- (void )prepareCellForShowAnimation : (UITableViewCell<YALContextMenuCell> *)cell {
250260
251- [self resetAnimatedIconForCell: cell];
261+ // [self resetAnimatedIconForCell:cell];
252262
253263 Direction direction;
254264 BOOL clockwise;
0 commit comments