Commit cf2e3ca7 by Shoaib Ahmed

Resolves issue #456 (TextField misplaced placeholder (RTL))

parent c309b843
...@@ -477,6 +477,7 @@ public class TextField : UITextField { ...@@ -477,6 +477,7 @@ public class TextField : UITextField {
preparePlaceholderLabel() preparePlaceholderLabel()
prepareDetailLabel() prepareDetailLabel()
prepareTargetHandlers() prepareTargetHandlers()
prepareTextAlignment()
} }
/// Ensures that the components are sized correctly. /// Ensures that the components are sized correctly.
...@@ -628,4 +629,14 @@ public class TextField : UITextField { ...@@ -628,4 +629,14 @@ public class TextField : UITextField {
addTarget(self, action: #selector(handleEditingDidBegin), forControlEvents: .EditingDidBegin) addTarget(self, action: #selector(handleEditingDidBegin), forControlEvents: .EditingDidBegin)
addTarget(self, action: #selector(handleEditingDidEnd), forControlEvents: .EditingDidEnd) addTarget(self, action: #selector(handleEditingDidEnd), forControlEvents: .EditingDidEnd)
} }
/// Prepares the target handlers.
private func prepareTextAlignment() {
if (UIApplication.sharedApplication().userInterfaceLayoutDirection == .RightToLeft) {
self.textAlignment = .Right
}
else {
self.textAlignment = .Left
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment