TEAM LICENSES: Save money and learn new skills through a Hacking with Swift+ team license >>

Challenge 07 from HWS [UIKit] - can't edit text field

Forums > 100 Days of Swift

This is an attempt at doing the Milestone Projects 19-21 from HWS (the UIKit version).

The challenge is to recreate the Apple Notes app. I've got the basic setup working (the data model, extensions, a data manager).

Here's the code: https://github.com/rjhoover/testingTextField

The app basically works in that it can:

  • add a new default note
  • save notes to disk
  • load saved notes from disk into a UITableView
  • the user can click one of the rows and be taken to a screen where they can change the text of the note body -- but they can't edit the title text field

The UITextField in the NoteViewController (titleTextField), as far as I can tell, is set up correctly with a TextField object in the main storyboard and an IBOutlet from the storyboard to the NoteViewController.swift file. But, I'm not able to edit the title in the text field. The body UITextView works fine; it lets you change the text and will save it to disk, but for some reason it won't let you change the title text field.

I can't see anything wrong with the code or the storyboard, but I have limited experience with storyboards and UIKit.

Can anyone see what the problem is? I've been fighting over this for more than a day and all I can find online is around ten years old (and it's objc code).

I need help

3      

Hi, In the Main.storyboard go to your Note view controller scene select the Navigation Item and set Large Title to never, it seems to be getting in the way.

3      

Yes, as @Hectorcrdna said, it is NavigationBar that is placed above your textfield that prevents from interaction with it. You can change it either via storyboard or add this line in your NoteViewController -> in viewDidLoad navigationItem.largeTitleDisplayMode = .never. Or you can move texfield a bit down so that it is tappable.

3      

That worked! Wow, thanks so much to @Hectorcrdna and @ygeras

3      

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.