So, i've been looking anywhere an explanation about how to implement Mirroring on Storyboard's Auto Layout - not programmatically.
I have an app that support a few languages and when i turn the language to Hebrew, for example, i have a label that change it's text to hebrew. so far so good. what i want to do next is to change the label's place like a mirror.
Can anyone help me understand how to do it on Storyboard Auto Layout?
Thanks.
After doing some research, i found the answer:
First, you have to implement an Internationalization. you can follow Ray's Wenderlich tutorial for Internationalization by enter this link:
http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014 .
Now, on Storyboard, all you have to do is putting some constraints to your label:
put trailing and leading constraints to the label you want to reflect like a mirror when the user switch the language, and that's it.
It's much more easy then design a new Storyboard and you're using the elements that Apple gave you, so i guess it's the right way too.
Hope it helps.
Related
I am working on auto layout and making those UIIMages as Button.
I would like to make those button to be clicked and switch the images
as well as showing some words in the label.
In this case what should I do?
In addition, as it is shown, the auto layout ratio is different only from the iPhone SE. In. this case What should I consider?
Many thanks,
The first thing you need to learn is auto layout. Start with basic Always go with Apple's doc first
This one I likes he is good and you will also find how to use buttons as image view, using card game example, check other tutorials also very helpfull.
Stanford university autolayout by Michel Deiman
As far, your question just gives your label Horizontal in the container constraints(open storyboard in the right bottom third from last (allin) click on it popUp will open), and 20 bottom to the buttons and it will be in the centre. Every elements need x,y height and width so it knows exactly where to place, so you also need to give constraints to the buttons, Learn stackView to understand how to place your button without giving many constraints to each button and stack view will handle it for you, try hide and show to one of the button and magically stack view will adjust all adjustment. I suggest before staring Do read apple's doc first.
And Your question is too broad to answer, so read and try adding different constraints based on your need and ask a specific question(after trying by yourself) like why this label getting cut what constraints should i add so people know exactly what you want to achieve, people are always ready to help, just ask the right question.
happyCoding
I'm new to swift programming and storyboard usage. I want to know if it is possible to place my views inside a ScrollView using Storyboard and AutoLayout but visually. I'm not an expert so programming the constraints is a little hard for me now.
If it's possible can someone point me to a good starting point using xCode 6+. I'm planning to use iOS8+ as a requirement.
Thanks all!
It's pretty easy!
I've written a tutorial that explain how to use UIScrollView with Auto Layout in iOS 8 and Swift.
Take a look, hopefully will help you :).
https://www.dribba.com/blog/2015/07/21/scrollview-autolayout-ios8-swift/
Yes, it is possible. I do it all the time in my current projects.
Just make sure you connect (auto layout constraints) your scrollable contents to all sides of the scrollview, so that it can calculate the content size correctly.
Autolayout + UIScrollView is not a simple topic. Apple has a technical note on it:
https://developer.apple.com/library/ios/technotes/tn2154/_index.html
I found these tutorials useful:
http://natashatherobot.com/ios-autolayout-scrollview/
http://mobileoop.com/auto-layout-advanced-techniques-for-ios-8-and-7-using-xcode-6-on-storyboard
http://spin.atomicobject.com/2014/03/05/uiscrollview-autolayout-ios/?utm_source=maniacdev-ao&utm_medium=social&utm_campaign=uiscrollview-autolayout-ios
I'm using storyboard.
And I have a toolbar with toolbarButtonItems separated by flexible spaces.
I want labels for each buttons. So I put labels in storyboard, but when rotating the device to landscape, labels are not aligned with buttons.
How can I solve this?
Any suggestions are welcome.
Kindest regards,
Well good sir, like many before you, you're presented with a two options.
Use Auto-Layout's Constraint system to describe what you want.
Use -layoutSubviews, and manually reposition the views in your ViewController.
The Second document on is on how to subclass UIView's in general. Defiantly worth the read. Since you said you're a beginner, it's probably best to use Auto-Layout, so you should probably start there.
I am working on an application, where I have to implement arbic as well as english locale.
I have made seperate storyboards for both languages. Problem is autolayout constraints are automatically flipping my views. Is there anyway to stop auto flipping for arabic locale?
I want to design views myself for arabic.
Thanks
Constraints by default respect language direction, but you can turn this off by selecting the constraint, and then in the Attributes Inspector, unchecking the Respect language direction in the First Item and the Second Item pop down menus.
Note that that option isn't available for all constraints.
I have a problem that the position of a button \ image is changed according to the language localization.
e.g. in Hebrew the alignment is right-to-left in opposite to English.
this causes the buttons \ images to be positioned on the other side of the screen, in oppose to English position.
how do I disable ios from re-positioning the buttons (according to localization)?
How many languages are there for localization in your application?
If you think that there are more problems in UI then create separate .xibs file for separate localization.
Please check the link. This will help you.
https://www.clairereynaud.net/blog/getting-your-iphone-app-ready-for-localization/
I've found a simple way for doing this:
go to the controller you want to fix it's position, and select it's constraints.
set Direction property to "Left to Right" instead of Leading to Trailing".