Professional Web Applications Themes

init in childclass is not called - Mac Programming

Hello, I have a class derived from NSImageView: interface RWKImageView : NSImageView Now I wanted to start a NSTimer in -(id)init: But it is not called. Also - (id)initWithFrame:(NSRect)frameRect is not called. And windowDidLoad is not called too. Where can I place the code in my class to start the NSTimer? Bye - Robert...

  1. #1

    Default init in childclass is not called

    Hello,

    I have a class derived from NSImageView:

    interface RWKImageView : NSImageView

    Now I wanted to start a NSTimer in -(id)init:

    But it is not called. Also - (id)initWithFrame:(NSRect)frameRect is not
    called. And windowDidLoad is not called too. Where can I place the code
    in my class to start the NSTimer?

    Bye - Robert
    Robert Guest

  2. #2

    Default Re: init in childclass is not called

    de (Robert W. Kuhn) wrote in message news:<1gcibyv.7srwqkjub00mN%de>... 

    I assume you subclassed in Interface Builder, and this object is part
    of a frozen NIB, so the best place is - (void)awakeFromNib. This
    method will be called once all of the connections are made between the
    various things loaded in from the NIB.

    A.J. Musgrove
    Arthur Guest

  3. #3

    Default Re: init in childclass is not called

    Robert W. Kuhn <de> wrote:
     

    You are asking two different questions. If the question is, "Where can I
    place this code?", the answer is, "Anywhere you like." If the question
    is, "What is called as this class is instantiated?", the answer is,
    "That depends on how you instantiate it." How *do* you instantiate it?
    If from the nib, then may I invite you to read the manual? For example,
    the Help for IB says:
     

    m.
    --
    matt neuburg, phd = com, http://www.tidbits.com/matt/
    AppleScript: The Definitive Guide
    http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
    Read TidBITS! It's free and smart. http://www.tidbits.com
    matt Guest

  4. #4

    Default Re: init in childclass is not called

    In article <1gcibyv.7srwqkjub00mN%de>,
    de (Robert W. Kuhn) wrote:
     

    Your wonderful descriptions has me entirely convinced that you have done
    everything correctly and don't need to post any code that shows how the
    methods are written or how they're called.

    The previous sentence was a complete lie. I'm a bad person like that.
    Doc Guest

  5. #5

    Default Re: init in childclass is not called

    Arthur J. Musgrove schrieb:
     
    >
    > I assume you subclassed in Interface Builder, and this object is part
    > of a frozen NIB, so the best place is - (void)awakeFromNib. This
    > method will be called once all of the connections are made between the
    > various things loaded in from the NIB.[/ref]

    Ooh yes, thanks. Two months away from cocoa and I ask the stupid faqs.
    Sorry.

    But another one. What is the counterpart to awakeFromNib when closing the
    window? Is there something like goToSleepIntoNib?

    Bye - Robert
    Robert Guest

  6. #6

    Default Re: init in childclass is not called

    On Tue, 20 Apr 2004, Robert W. Kuhn wrote:
     

    Do you just want to know when the window closed (and could be re-opened
    again) or when the window is deallocated? If the former, sign up for the
    appropriate notification. If the latter, implement -dealloc.
    Michael Guest

Similar Threads

  1. Replies: 8
    Last Post: December 19th, 03:08 PM
  2. Replies: 0
    Last Post: November 29th, 10:21 AM
  3. Replies: 0
    Last Post: November 29th, 10:03 AM
  4. Kernel panic: No init found. Try passing init = option to kernel
    By Liviu in forum Linux Setup, Configuration & Administration
    Replies: 2
    Last Post: October 31st, 03:56 PM
  5. init.d
    By Stojcevski Dejan in forum Sun Solaris
    Replies: 4
    Last Post: August 2nd, 02:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139