I did the following:
1. Dragged UIView to place it in the ViewController ribbon
- Created a custom UIView class and added the outlets to the 'Edit Profile View' view fields:
import UIKit
class EditProfileView: UIView {
let globalDataHandler = GlobalDataHandler.sharedInstance
@IBOutlet weak var firstNameTextField: UITextField!
@IBOutlet weak var lastNameTextField: UITextField!
@IBOutlet weak var userNameTextField: UITextField!
@IBOutlet weak var passwordTextField: UITextField!
@IBOutlet weak var emailTextField: UITextField!
@IBAction func saveEditButton(sender: AnyObject) {
}
@IBAction func cancelEditButton(sender: AnyObject) {
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Drawing code
}
*/
}
Gave 'EditProfileView' class as the Custom Class for the 'Edit Profile View' view in Storyboard.
Created an object for 'EditProfileView' class in ProfileViewController and added the 'Edit Profile View' view to the main view upon clicking edit button in ProfileViewController.
class ProfileViewController: UIViewController {
let profileView = EditProfileView()
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func editProfileButton(sender: AnyObject) {
profileView.firstNameTextField.text = "First Name"
profileView.lastNameTextField.text = "Last Name"
profileView.userNameTextField.text = "User Name"
profileView.emailTextField.text = "Email"
let testFrame : CGRect = CGRectMake(50,100,300,300)
profileView.frame = testFrame
self.view.addSubview(profileView)
}
}
But, the 'Edit Profile View' view doesn't appear on ProfileViewController. Please help.