Images do not look right

The images for the main view look a little funny, and I’m not sure why. Below is a screenshot.

I see what you mean - it looks as if the corner radius for some of the views (like the slider track and the button on the bottom left) have been adjusted.

Can’t tell what is going on by looking at just the screenshot though. If you can upload a ZIP file of the project somewhere and provide a link to it here I can take a look.

The issue with the “Restart” button was simply that it was stretched out too much. You can simply select the button in Interface Builder and then use the Editor - Size to Fit Content command to set the button back to a size which fits its background image.

For the slider, instead of setting resizable images for the track, you were setting the original image :slight_smile: Your code looks like this:

    let trackLeftImage = #imageLiteral(resourceName: "SliderTrackLeft")
    trackLeftImage.resizableImage(withCapInsets: insets)
    slider.setMinimumTrackImage(trackLeftImage, for: .normal)
    let trackRightImage = #imageLiteral(resourceName: "SliderTrackRight")
    trackRightImage.resizableImage(withCapInsets: insets)
    slider.setMaximumTrackImage(trackRightImage, for: .normal)

But it should be:

let trackLeftResizable =
  trackLeftImage.resizableImage(withCapInsets: insets)
slider.setMinimumTrackImage(trackLeftResizable, for: .normal)

let trackRightImage = #imageLiteral(resourceName: "SliderTrackRight")
let trackRightResizable =
  trackRightImage.resizableImage(withCapInsets: insets)
slider.setMaximumTrackImage(trackRightResizable, for: .normal)

Notice how you do not assign the resizable image to a variable in your code nor do you use the resizable image in your calls to setMinimumTrackImage and setMaximumTrackImage.

1 Like

Thanks. That works.

I think the problem was I was testing out App Code from Jet Brains and deleted something and forgot to put it back.

I’m just going to still with xCode for IOS/Mac stuff.

This topic was automatically closed after 166 days. New replies are no longer allowed.