如何使 UIBarButtonItem 不是 scaleToFit?

How to make a UIBarButtonItem NOT scaleToFit?

我正在创建一个带有自定义图像的 UIBarButtonItem:

UIButton *tempSpeedButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, buttonWidth, buttonHeight)];
        UIImage *speedImage = [[UIImage imageNamed:@"eye"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
        [tempSpeedButton setBackgroundImage:speedImage forState:UIControlStateNormal];
        [tempSpeedButton addTarget:self action:@selector(onSpeed) forControlEvents:UIControlEventTouchUpInside];
        tempSpeedButton.contentMode = UIViewContentModeScaleAspectFit;
        UIBarButtonItem* speedButton = [[UIBarButtonItem alloc] initWithCustomView:tempSpeedButton];

图片看起来被拉长了。我怎样才能让它正常适应?

谢谢!

我所要做的就是添加这个:

[tempSpeedButton sizeToFit];