0

I have a document-based application. The app doesn't use Core Data. It has 2 TextFields: one used as an area to edit document (called it main TextField), one used as a search box. By the default, when I type in any of these TextField, the app auto change it state to "edited" and the close button on title bar change.

I disabled autoSaving by overriding:

override class func autosavesInPlace() -> Bool {
    return false
}

What I want is the app only change its state to "edited" when I type in the main TextField. When I type in search TextField, I don't want the app change its state change. How can I achieve this behavior?

Thanks.

Bao Nguyen
  • 137
  • 9
  • The behavior you describe is not "default". You must have mistakenly hooked or bound your search field into your data model somehow. Is this document using Core Data? – Jerry Krinock Sep 05 '15 at 13:30
  • My app doesn't use Core Data – Bao Nguyen Sep 05 '15 at 13:35
  • To find out what is causing this, in Xcode's Breakpoint navigator at the bottom, click the "+" button and Add Symbolic Breakpoint with Symbol "-[NSUndoManager registerUndoWithTarget:selector:object:]". Then add another one with Symbol "-[NSUndoManager prepareWithInvocationTarget:]". Then run your app and type into the search field. One of them should break. Study the call stack in the Debug navigator and it will tell you what is causing your document to become dirty. – Jerry Krinock Sep 05 '15 at 14:38

0 Answers0