You want NSTextAlignmentNatural
. That infers the text alignment from the loaded application language (not from the script).
For iOS 9 and later (using Xcode 7), you can set this in the storyboard (choose the — alignment option). If you need to target earlier releases, you’ll need to create an outlet to the label and set the alignment in awakeFromNib
.
- (void)awakeFromNib {
[[self label] setTextAlignment:NSTextAlignmentNatural];
}
Related Contents:
- UIScrollView Scrollable Content Size Ambiguity
- How to use Auto Layout to move other views when a view is hidden?
- Xcode – How to fix ‘NSUnknownKeyException’, reason: … this class is not key value coding-compliant for the key X” error?
- How to add constraints programmatically using Swift
- How do I animate constraint changes?
- Should IBOutlets be strong or weak under ARC?
- UICollectionView Self Sizing Cells with Auto Layout
- How do I adjust the anchor point of a CALayer, when Auto Layout is being used?
- When is layoutSubviews called?
- UILabel sizeToFit doesn’t work with autolayout ios6
- How do I programmatically set device orientation in iOS 7?
- UISplitViewController in portrait on iPhone shows detail VC instead of master
- Is it possible to set UIView border properties from interface builder?
- iOS: How does one animate to new autolayout constraint (height)
- Auto layout constraints issue on iOS7 in UITableViewCell
- How to create percentage of total width using autolayout?
- Are NSLayoutConstraints animatable? [duplicate]
- iOS: Multi-line UILabel in Auto Layout
- Is it possible for UIStackView to scroll?
- UITextView that expands to text using auto layout
- Xcode 9 – “Fixed Width Constraints May Cause Clipping” and Other Localization Warnings
- AutoLayout with hidden UIViews?
- Is it possible to obtain a dynamic table view section header height using Auto Layout?
- With Auto Layout, how do I make a UIImageView’s size dynamic depending on the image?
- AutoLayout: removeFromSuperview / removeConstraints throws exception and crashes hard
- Automatic Preferred Max Layout Width is not available on iOS versions prior to 8.0
- How can I use Autolayout to set constraints on my UIScrollview?
- Multiple UILabels inside a self sizing UITableViewCell
- Wrap items in a horizontal UIStackView on multiple lines
- UIScrollView and Constraints
- How to determine height of UICollectionView with FlowLayout
- How can I get a view’s current width and height when using autolayout constraints?
- How to dynamically change the font size in auto layout iOS?
- How to add Equal Spacing and equal width for button in iOS Auto layout
- How do you shrink a UIPickerView on the iPhone?
- Why is UICollectionViewCell’s outlet nil?
- Autolayout: Add constraint to superview and not Top Layout Guide?
- When can I activate/deactivate layout constraints?
- Disable autolayout constraint error messages in debug console output in Xcode
- Custom Font Sizing in Xcode 6 Size Classes not working properly with Custom Fonts
- What are File Owner and First Responder in iOS – Xcode?
- Auto-layout: What creates constraints named UIView-Encapsulated-Layout-Width & Height?
- How to keep a round imageView round using auto layout?
- UIButton that resizes to fit its titleLabel
- Moving views with constraints
- What are the benefits of using Storyboards instead of xib files in iOS programming?
- When should translatesAutoresizingMaskIntoConstraints be set to true?
- iOS ScrollView needs constraint for y position or height
- Can I use autolayout to provide different constraints for landscape and portrait orientations?
- On iOS, what are the differences between margins, edge insets, content insets, alignment rects, layout margins, anchors…?