2

我正在升级我的应用程序以使用 iOS 13。我一直在使用 UIWindow 将图像添加到当前屏幕。但是在 ios 13 中,图像会出现,但随后会立即消失。我尝试在以前的版本 ios 12.2 中构建,它工作正常。

这是我的代码:

 UIWindow *currentWindow = [UIApplication sharedApplication].keyWindow;

    UIImage *image = [UIImage imageNamed:@"test_badge" inBundle:VTBundle compatibleWithTraitCollection:nil];
    UIImageView *badgeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, [currentWindow bounds].size.height-115, 115, 115)];
    badgeImageView.tag =100101;
    badgeImageView.image = image;

    [currentWindow addSubview:badgeImageView];
4

0 回答 0