• 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
Newbie Q on posing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie Q on posing


  • Subject: Newbie Q on posing
  • From: email@hidden
  • Date: Sat, 22 Jul 2006 19:36:26 +0200 (CEST)
  • Importance: Normal

         Hello all,

 I created a subclass of NSTextView (called GGTextView) that differs
from its superclass only by the implementation of the
-pageFooter: method, and I'm trying to "replace
NSTextView with GGTextView everywhere" in the source code
for TextEdit, so that when the new version of TextEdit runs
only the new "-pageFooter:" method is called.

 So I replaced NSTextView with GGTextView in the .h and .m files where
it was possible, and seemed reasonable, to do so.
(In particular :

    1)      replace every [[NSTextView alloc] init] with [[GGTextView
alloc] init]
    2)    replace every method returning an NSTextView with one
    returning an GGTextView.
)


  Having done this, I get a project that builds without "incompatible
types" warnings
and runs fine, but unfortunately does not do what I want in some cases :
sometimes
a text view is of class NSTextView instead of GGTextView. My guess is that
this problem
comes from the only case where I could not apply rule 2), namely the method

  - (NSTextView *)firstTextView {
    return [[self layoutManager] firstTextView];
}

  in Document.m. The stumbling block here is that, one way or another,
one has to "transform an NSTextView into a GGTextView." I tried to replace
the
code above with the following :

 - (GGTextView *)firstTextView {
    [GGTextView poseAsClass: [NSTextView class]];
    return [[self layoutManager] firstTextView];
}


 This produces a warning and a crash at runtime. What is the right way to
use posing
in this situation ? Should I leave all those NSTextViews alone and just
add the line

  [GGTextView poseAsClass: [NSTextView class]];

in a piece of code that gets called early ?

                                                                    Ewan


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Finding out if an NSArray's contents are all equal
  • Next by Date: Re: Writing application without Interface Builder
  • Previous by thread: objectDidEndEditing bug?
  • Next by thread: Editing the HUD window text edit question
  • Index(es):
    • Date
    • Thread