• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Programmatically adding an NSTextField to an NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically adding an NSTextField to an NSTextView


  • Subject: Re: Programmatically adding an NSTextField to an NSTextView
  • From: Keith Bauer <email@hidden>
  • Date: Sun, 9 Feb 2003 19:57:58 +1300

[textField removeFromSuperview];
[textView addSubview: textField];
[textField setFrame:cellFrame];

Well, I've solved my problem. The problem was the removeFromSuperview call. If I remove that, everything works as expected.

removeFromSuperview will release the view, so you will have to retain it before hand and then release it after adding it to a different > view.

Good to know, but the view's retain count obviously never dropped to zero, since it still existed and displayed correctly. The only thing wrong was the exception that was being printed, and the inability to edit the field:

*** NSRunStorage, _NSBlockNumberForIndex(): index (0) beyond array bounds (0)

-Keith
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Programmatically adding an NSTextField to an NSTextView (From: Nathan Day <email@hidden>)

  • Prev by Date: Re: Programmatically adding an NSTextField to an NSTextView
  • Next by Date: scriptSuite
  • Previous by thread: Re: Programmatically adding an NSTextField to an NSTextView
  • Next by thread: Re: Question about TableView - how do I know which tableView?
  • Index(es):
    • Date
    • Thread