ios - Custom View in xib not working -
i have vpmotpview custom view in `.xib' this.
class verifyotp: uiview { @iboutlet weak var otpview: vpmotpview! var emailid = "" var userid = "" @ibaction func resendotpaction(_ sender: uibutton) { print("asdds") } override func awakefromnib() { super.awakefromnib() otpview.otpfieldscount = 4 otpview.otpfielddefaultbordercolor = uicolor.blue otpview.otpfieldenteredbordercolor = uicolor.red otpview.otpfieldborderwidth = 2 otpview.delegate = self // create ui otpview.initalizeui() } } extension verifyotp: vpmotpviewdelegate { func hasenteredallotp(hasentered: bool) { print("has entered otp? \(hasentered)") } func enteredotp(otpstring: string) { print("otpstring: \(otpstring)") } }
then in 'viewcontroller'
var verifyotpview: verifyotp? self.verifyotpview = verifyotp.fromnib() self.verifyotpview?.frame = cgrect(x: 20, y: 0, width: screensize.width - 40, height: screensize.height / 3) self.view.addsubview(self.verifyotpview!)
but can see resend otp button on screen otpview not displayed.
from screenshot doesn't have constraints set views?
if not try adding constraints , see if fixes problem.
Comments
Post a Comment