UILabel text alignment only working in iOS simulator - ios

I've created a custom cell with several UILabels and everything works great, but for some reason I can't seem to get the text in any of my labels to do anything other than center.
Everything was created in Storyboard, and I set the left-alignment attribute, it looks perfect in the simulator, but when I test my code on my iPhone, all the labels center.
Since it's all in Storyboard, there isn't really any code snippet I can share, is there something I'm missing?

Did You remove app from device ? sometimes when adding/testing style features, old style is appended, until You delete the app.

Do one or both of the following:
Remove the app from your device and re-build it onto the device
Remove the folders in the DerivedData associated with your app. By default, the DerivedData folder is is located at /Library/Developer/Xcode/DerivedData/
This usually fixes all the Ui-related issues I've come across.

It turned out that autolayout was changing the size of the Labels in my cell, turning that off seems to have resolved the issue for now.

Related

iOS app missing splash screen, new black borders and ui glitching after visualstudio 8.10.10 and xcode 13 update

Just updated to Xcode 13 and Visualstudio Mac to 8.10.10. Since then my app:
Wont display the splash screen.
The app is cropped at top and bottom.
Ui is acting generally weird.
Now I have read old threads on similar problems and adding the Launch screen interface file base name. in the info.plist file does make the app cover the whole screen.
I have tried switching splash screens and change location. But it's just black. I don't use a storyboard for the splash and instead provide several different resolutions, which have worked fine for several years.
The UI is glitching like the loader picture, and several different ui elements where colors are provided are "cut" in the middle showing two colors when it should switch.
I have read the release notes for xcode13 but haven't found anything related that would break the whole UI.
The interface glitching and no splash screen I can't seem to find a solution for. Everything worked fine before the update.
What could be the problem? Some setting in the info.plist, a checkbox in the storyboard?
I'm still new to Xamarin and iOS development and greatly accept suggestions.
Let me know if I can clarify anything.
Thanks
iOS load glitch picture
According to your statement, you are not using a storyboard, so you need to replace the Launch Screen with a LaunchImage, then check the LaunchImage file (if it does not exist, you need to create it yourself) and add all strictly standardized pictures inside.

iOS app not taking up entire screen in iOS 12 or 13

I have an old iOS app last built on iOS 8. When the app runs on iOS 10 or higher on larger phones the view doesn't take up the entire screen, there is a black bar on the top and bottom of the screen. In the past, Apple would just expand the app so it was stretched a little.
Not sure how to fix this? I am sure there has to be an expand setting or something? I believe it has to do with setting a Launch Screen, but not sure where to set that or how to? I do have a LaunchScreen.storyboard in my files.
I have tried multiple things to fix the issue, but nothing seems to work?
Also, not sure if it is related, but the Navigation Item (deprecated?) was once sticking to the top and now just randomly floats.
I have solved this problem on my older project by adding launch screen.
Try this if you are missing launch screen:
Add a new launch screen by going to File -> New -> File... -> Launch
Screen
Make sure the newly added LaunchScreen.storyboard is selected as
the launch screen file under project settings.
to check this follow this steps:
1)Choose your project name in Xcode. 2)Select your project target. 3)Then select app icons and launch images and choose your newly added LaunchScreen.storyboard.
Given the age of the app I suspect it uses fixed sizes or size classes for its layout?
You will need to update the code that controls the layout. If the design is simple and vertical based, you may be able to a 'quick and dirty" solution by embedding everything in a stack view. However you should really update your code and/or storyboard to use Autolayout. This will fix the current problem and ensure it will work with future devices of different sizes.

UIImageView in storyboard not showing on device and simulator

I have a UIImageView in storyboard. I have placed a .png image in .xcassests folder. I have correctly assigned the image name to the UIImageView which correctly shows in Xcode Storyboard. However when I run it on device/simulator, there is no image displayed. When I create the UIImageView in code then the image is displayed. My project code is in Objective-C
I have tried the following already
Clean Xcode project
Cleared Derived Data
Closed Xcode and restarted device/simulator
Deleted all images from .xcassets and reassigned
However none of the above has worked for me so far. Any suggestions are highly appreciated.
Well, it should work from what you implemented see. Xcode gets weird sometimes when it comes to referencing resources. I recommend removing the images, clean and build if possible remove the view controller and add again. See if it works.
Seems like there is no issue with the implementation part. Try adding clips to bounds to imageView
In case other people find this issue and struggle with it. The solution is simple.
Select your XCAssets Container:
Then select your target membership in the right hand panel
Right click on the image in Xcode, go to File Inspector, and check the checkbox under "Target Membership". This might help.
Set the alpha of imageView as 1 instead of 0.

Button is resizing when app is run either in the simulator or on an actual device

So here is my problem:
I am building an iPhone app (not universal) for deployment on iOS 7.0. In my very first View Controller I have two buttons. Both buttons are set as "Custom" and just contain a text png I made in Illustrator as the image for the button. My first button works great. It has both the #2x version and the normal version in the Image.xcassets folder under its own icon name. My next button work exactly the same way, except with different text file. It was created the same way. It looks great inside the storyboard, but when I run my app on either a simulator or an actual device, the 2nd button resizes itself. I have no clue how to fix this.
So far I have tried cleaning the project, restarting Xcode, reinserting the image file, playing with the button properties inside of the storyboard, and turning OFF auto layout.
Here is a screenshot of the simulator running next to the storyboard view in Xcode:
It sounds like the Attributes > View > Mode on the second button may be set differently, but you mentioned you have tried adjusting setting. Try deleting the button that is not working, duplicating the one that is working and changing the image in the duplicate to the second image.
To be sure there is not something unusual going on with your image (can't really imagine what), have you tried using the image that is shrinking in the button that seems to be ok?
You can also click on the "Resolve Auto Layout Issues > Reset to Suggested Constraints" to see if that helps. You can also try clearing all constraints and resetting them via that same menu.

iOS XCode Storyboard controls moved and now look strange in simulator

I am following the course on iOS through iTunes university and working on the calculator project. I moved the controls on the storyboard to make room for another control at the top. Everything looks fine on the storyboard but when run in the simulator, controls are bunch up, on top of each other, and some are clearly off the top of the simulator screen. This leads to the following very related questions.
How does one move controls around on the storyboard? I went to the size inspector of each control (buttons in my case) and changed the 'Y' value (increased it by 10). I did this for each control. I didn't think about it as I was doing it because as I said, all looks fine on the storyboard. Is there a better way to move controls around? I could not figure out how to grab more than one control at a time and move them. Grabbing all and moving or all but one and moving would have been ideal.
I anticipate someone is going to say, "We need more info. " How do I show the storyboard? Is there a xml file somewhere? How is the storyboard saved? How should I show the results of the simulator?
In general, what the heck is going on? Why would things look so different in the simulator?
Is there a better forum/group to ask newbie questions about iOS programming?
My specs are these:
XCode 4.5.2
Ios simulator versions set to 6.0 and iPhone
Any other info needed? Thanks in advance,
Dave
Try setting your simulated device size to 'freeform' instead of 'inferred'. This screen is a bit smaller so the controls are no longer overlapping. The latest xcode sets it by default to ios6 (screen size of iPhone 5)
edit For a better insight in xcode IDE, please refer to the documentation provided by apple (includes screenshots for clarity)
https://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/000-About_Xcode/about.html#//apple_ref/doc/uid/TP40010215

Resources