Floaty
Floaty copied to clipboard
UI glitch when setting [floaty setButtonImage:theNewImage]; iPhone X iPhone XR iPhone XS
Im using Objective c and after initialization of Floaty I want to change buttonImage via FloatyDelegate
like this:
- (void)floatyWillOpen:(Floaty *)floaty
{
[floaty setButtonImage:[UIImage imageNamed:kCloseMeny]];
}
- (void)floatyWillClose:(Floaty *)floaty
{
[floaty setButtonImage:[UIImage imageNamed:kOpenMeny]];
}
For some reason Every other call seems to add 34 pixel to position. If Im writing out frame in console I get:
2019-03-04 08:37:48.897801+0100 Mock[23973:1599831] frame: (305.000000, 654.000000)
2019-03-04 08:37:49.996865+0100 Mock[23973:1599831] frame: (305.000000, 620.000000)
2019-03-04 08:37:51.096686+0100 Mock[23973:1599831] frame: (305.000000, 654.000000)
2019-03-04 08:37:52.095173+0100 Mock[23973:1599831] frame: (305.000000, 620.000000)
2019-03-04 08:37:52.979874+0100 Mock[23973:1599831] frame: (305.000000, 654.000000)
If Im doing the same on iPhone 8 or devices with "regular" screen (physical home screen and no face recognition) Im not experiencing this issue. Here is same console log for iPhone 8:
2019-03-04 08:40:17.395955+0100 Mock[24647:1615869] frame: (305.000000, 533.000000)
2019-03-04 08:40:18.495812+0100 Mock[24647:1615869] frame: (305.000000, 533.000000)
2019-03-04 08:40:19.596411+0100 Mock[24647:1615869] frame: (305.000000, 533.000000)
2019-03-04 08:40:20.334146+0100 Mock[24647:1615869] frame: (305.000000, 533.000000)
2019-03-04 08:40:21.101390+0100 Mock[24647:1615869] frame: (305.000000, 533.000000)
2019-03-04 08:40:22.323964+0100 Mock[24647:1615869] frame: (305.000000, 533.000000)
This is my setup method:
- (void)setupExpandingMenu
{
__weak typeof(self) weakSelf = self;
Floaty *floatyMenu = [Floaty new];
[floatyMenu setButtonImage:[UIImage imageNamed:kOpenMeny]];
floatyMenu.rotationDegrees = 0;
floatyMenu.overlayColor = [UIColor.blackColor colorWithAlphaComponent:kMenuAlpha];
floatyMenu.fabDelegate = self;
FloatyItem *gotoNewVersionItem = [[FloatyItem alloc] init];
gotoNewVersionItem.title = @"GO TO NEW VERSION";
gotoNewVersionItem.titleLabel.font = [CAPPTextStyle textHeadingThomasBold].font;
gotoNewVersionItem.titleLabel.textAlignment = NSTextAlignmentRight;
gotoNewVersionItem.icon = [UIImage imageNamed:kSneakPeekGotoTripView];
gotoNewVersionItem.handler = ^(FloatyItem * item) {
// tap action
};
[floatyMenu addItemWithItem:gotoNewVersionItem];
[self.view addSubview:floatyMenu];
}