Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8003375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:38:01+00:00 2026-06-04T16:38:01+00:00

For a Cocoa application I am writing, I would like to support a panel

  • 0

For a Cocoa application I am writing, I would like to support a panel to the right of the main document content where users can add notes for the currently selected document content. (If you are familiar with Microsoft Word or Scrivener, this feature is similar to the comment feature in those applications.) Scrivener does a nice job of starting with a text field sized to fit the default text, and then growing it taller as the user types into it. I’d like to implement the same behavior for my Cocoa app.

What’s the basic strategy?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:38:02+00:00Added an answer on June 4, 2026 at 4:38 pm

    There are delegate methods that allow you to capture the actual keystrokes as they come in.

    Implement the below delegate method to resign first responder, based upon the keyboard

    -(BOOL)textFieldShouldReturn:(UITextField *)textfield
    

    Implement the below delegate method to detect when focus has been given back to the TextField. You may also want to perform the deletion of current text, or retain the text that was already there if you wish

    -(void)textFieldDidBeginEditing:(UITextField *)textfield
    

    Implement the below delegate method to detect the character(s) entered and where (based on the caret position), and essentially add the characters to your privately held and displayed string (displayed out to your textfield that is)

    -(BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString
    

    Implement the below delegate method to detect when editing has finished so that you can perform any other cleanup etc… that you wish to do.

    -(void)textFieldDidEndEditing:(UITextField *)textField
    

    I will get back to you on the dynamic sizing of your TextView itself, but that (at least on iOS) as Ive seen has a solution and at one point I have used it. You will essentially make your font size static, potentially your width static, then edit your height based on how many lines you have, or you could keep your height static, and change your width based on characters, etc… up to you.

    Here is a great set of responses on StackOverflow about dynamic sizing
    How do I size a UITextView to its content?

    So if you combine the keystroke recognition with the dynamic sizing you should have it!!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Cocoa application in Objective-C, and I would like to be able
I have a Cocoa application (.app) and I would like to launch it from
I am writing a Mac Cocoa application that will manipulate database files, which can
I'm writing a standard Cocoa application, and I've just started implementing AppleScript support for
i need a simple logging solution while writing Cocoa/OpenGL application in C++. I'd like:
I am writing a Java application using SWT widgets. I would like to update
When writing an application for MacOSX, using Cocoa/Objective-C, I'd like to be able to
I am writing a Cocoa application for OS X, where the user can draw
I am writing a Cocoa application and I'd like to implement a global hotkey
I'm writing a Cocoa application that installs itself as an menulet in the menu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.