我有一个具有以下命名约定的图像。它总是在视网膜设备上显示非 2x 版本。我已从派生数据中删除了缓存图像,但仍未显示。如果我明确地将 imageNamed 设置为“Back”,它就可以工作。这些是图像。返回@2x.png 返回.png
UIImage *backImage = [UIImage imageNamed:@"Back"];
NSLog(@"back image height %f",backImage.size.height);
NSLog(@"back image width %f",backImage.size.width);
UIButton *btnBack = [UIButton buttonWithType:UIButtonTypeCustom];
[btnBack setImage:backImage forState:UIControlStateNormal];
btnBack.frame = CGRectMake(0, 0, backImage.size.width, backImage.size.height);
[btnBack addTarget:self action:@selector(Click_On_Btn_Back) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backBarButton = [[UIBarButtonItem alloc] initWithCustomView:btnBack];
self.navigationItem.leftBarButtonItem = backBarButton;