The screen is in the Arabic language and it's semantic is set right to left. The whole screen consists of a table view with customs cells. I need to change the semantics of one of the cells in the table view to left to right. The cell has two text fields side by side
I have tried cell.countryCodeField.semanticContentAttribute = .forceLeftToRight
which is not working
my custom cell
class EditmobileNumberCell: UITableViewCell {
@IBOutlet weak var mobileNumberField: UITextField!
@IBOutlet weak var countryCodeField: UITextField!
@IBOutlet weak var hintLabel: UILabel!
@IBOutlet weak var mobileNoPlaceHolder: UILabel!
@IBOutlet weak var backView: UIView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
countryCodeField.addRightImage(image: #imageLiteral(resourceName: "icMobileDropdown"), contMode: .bottom)
mobileNumberField.textAlignment = .left
countryCodeField.textAlignment = .left
hintLabel.textAlignment = .left
mobileNoPlaceHolder.textAlignment = .left
mobileNumberField.semanticContentAttribute = .forceLeftToRight
countryCodeField.semanticContentAttribute = .forceLeftToRight
hintLabel.semanticContentAttribute = .forceLeftToRight
mobileNoPlaceHolder.semanticContentAttribute = .forceLeftToRight
}
Any help will be appreciated. Thanks in advance.
To completely prevent selection of the UITableViewCell , have your UITableViewDelegate implement tableView:willSelectRowAtIndexPath: . From that method you can return nil if you do not want the row to be selected. This prevents the row from being selected and tableView:didSelectRowAtIndexPath: from being called.
Create a view inside the cell and add all the controllers inside it and then use view semanticContentAttribute to forceLeftToRight, in the above case write inside awakeFromNib() -
backView.semanticContentAttribute = .forceLeftToRight
This worked for me
You need to change semanticContentAttribute
for the tableView, changing the cell semanticContentAttribute
won't do any change.
tableView.semanticContentAttribute = .forceLeftToRight
That should get the job done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With