A Text Field With Capabilities of Displaying and removing a custom pop up
Points to note:-
In this func
public func displayPopup(errImg:String = "errMsg",popUpMsg:String,presentationController:UIViewController)
- make sure that errIcon is an image added to your assets
- the buttons frame matches the size of the image added to the assets , please do not use a big image as this is going to be added in the accessory view of the text field.
Replace this func :-
private func popOverViewInstance(errorMsg:String?)->UIViewController
{
let registerStoryboard = UIStoryboard.registerStoryboardReference()
let popOver = registerStoryboard.instantiateViewController(withIdentifier: kPopOverControllerIdentifier) as! PopOverVC
popOver.errMsg = errorMsg
return popOver
}
using the same func definintion but the only change being that you have to return your custom pop - up view controller for eg:-
private func popOverViewInstance(errorMsg:String?)->UIViewController
{
//instantiate , populate and return your custom pop over view controller
}
Its usage is as follows :-
currentTextField.displayPopup(popUpMsg: StringConstants.passwordMismatch, presentationController: controller)
and to remove it
currentTextField.removePopup()
NOTE:THIS IS A SUBCLASS OF FORM TEXT FIELD SO PLS ADD THAT FILE TOO
There are other attributes in the IBInspector pls have a look at it.
Please do not set the arrow image here as there is no use of it for this sub class directly set it in the function mentioned above
you can set the left offset , placeholder color as well as the placeholder font size