UI System Bug on iOS?

I used UI Button for the button in the bottom left corner that says “Back”. Once I click on it in the iOS simulator it becomes extremely tiny like in the 2nd picture. I also have a UI LoadingBar in another scene that is extremely stretched out for no reason. I’m running this on Cocos2d-x 3.8.1 C++.

I tested it on my Android phone with the exact same project and the UI System works fine, but it just doesn’t seem to work for iOS for some reason.

Does anyone know what’s wrong? This is my code:

homeButton = ui::Button::create("Button.png", "ButtonClicked.png");
    homeButton->setWidthAuto(s.width * .25);
    homeButton->setPosition(Vec2(homeButton->getWidth() * .5 + s.width * .05, homeButton->getHeight() * .5 + s.width * .05));
    homeButton->setTitleColor(Color3B::WHITE);
    homeButton->setTitleFontName("HoboStd.otf");
    homeButton->setTitleFontSize(homeButton->getHeight());
    homeButton->setTitleText("Back");
    this->addChild(homeButton);
    homeButton->setName("home");
    homeButton->addTouchEventListener(CC_CALLBACK_2(ScoreScene::touchEvent, this));

I noticed that it is on a simulator, does that happen on the actual device?

I will be testing this on a real iOS device tomorrow (unfortunately I don’t have an iOS device myself so I have to borrow my neighbor’s device) although I’m guessing it will look the same on the real iOS device. In my experience the iOS simulator is pretty reliable.

This is really puzzling to me because it looks fine on Android, and I’m building the APK for Android from the exact same code and resources. Is it possible that there is something wrong at the core of the UI System for iOS? Is anyone else experiencing this issue?

Sometime when that happens, I will disable scale 9 sprite (setScale9Enabled). You can give it a try.

Okay, I will try that but could you quickly tell me what scale9sprite is?

The game looked the same on my neighbor’s ipad as on the simulator, but I found out what was wrong.

It turns out that the issue was caused by the way that I copied my images into XCode. I had folders for large images, medium sized images, and small images. When I copied these folders into XCode I accidentally used the “Create Groups” option rather than the “Create Folder References” option, so my images were mixed together for the iOS version of my game. Everything is working just fine now.