Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserProfileTableViewController: UITableViewController {
- private var userInfoCell: UserInfoTableViewCell?
- ...
- override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
- if indexPath.section == 0 {
- userInfoCell = tableView.dequeueReusableCellWithIdentifier("userInfoCell", forIndexPath: indexPath) as? UserInfoTableViewCell
- if !editMode {
- userInfoCell?.nameField.becomeFirstResponder()
- }
- return userInfoCell!
- }
- else if indexPath.section == 1 {
- ....
- class UserInfoTableViewCell: UITableViewCell, UITextFieldDelegate,, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
- @IBOutlet weak var nameField: UITextField!
- @IBOutlet weak var photoImageView: UIImageView!
- ...
- override func awakeFromNib() {
- super.awakeFromNib()
- // listen for when user touches a textfield
- nameField.delegate = self
- ...
- }
- override func setSelected(selected: Bool, animated: Bool) {
- super.setSelected(selected, animated: animated)
- }
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement