Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.objective-c > #187

Re: Help with Objective C delegate not working

From "Pascal J. Bourguignon" <pjb@informatimago.com>
Newsgroups comp.lang.objective-c
Subject Re: Help with Objective C delegate not working
Date 2015-09-12 01:12 +0200
Organization Informatimago
Message-ID <878u8c7doy.fsf@kuiper.lan.informatimago.com> (permalink)
References <b27bb642-10d2-40fa-8e8c-de3843ac7c18@googlegroups.com> <87bnd9909l.fsf@kuiper.lan.informatimago.com> <b0b30d8e-22e5-488e-be98-143ed73ef00b@googlegroups.com>

Show all headers | View raw


Ronaldo Bahia <ronaldo@jobconvo.com> writes:

> Em quinta-feira, 10 de setembro de 2015 23:07:37 UTC-3, Pascal J. Bourguignon  escreveu:
>> Ronaldo Bahia <ronaldo@jobconvo.com> writes:
>> 
>> > I'm learning objective c and need help to understand delegate.
>> >
>> > I have a UITextField in the FirstViewController and I want to show the
>> > text inputed in the SecondViewController.
>> >
>> > But it's not working. What am I doing wrong?

viewDidLoad is not called by alloc or init.  It's called when you load
the view from a Nib file.
In your case, it's never called.

You should explicitely call a method of your SecondViewController to
give it the text to display.  In this case, you don't need a delegate.

in SecondViewController:

    -(void)setText:(id)newText {
        self.candidateLabel.text=newText;
    }

and in FirstViewController:

    secondViewController = [[SecondViewController alloc] init]; 
    [secondViewController setText:getCodeString];

-- 
__Pascal Bourguignon__                 http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk

Back to comp.lang.objective-c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Help with Objective C delegate not working Ronaldo Bahia <ronaldo@jobconvo.com> - 2015-09-10 17:28 -0700
  Re: Help with Objective C delegate not working "Pascal J. Bourguignon" <pjb@informatimago.com> - 2015-09-11 04:07 +0200
    Re: Help with Objective C delegate not working Ronaldo Bahia <ronaldo@jobconvo.com> - 2015-09-11 08:03 -0700
      Re: Help with Objective C delegate not working "Pascal J. Bourguignon" <pjb@informatimago.com> - 2015-09-12 01:12 +0200
        Re: Help with Objective C delegate not working Ronaldo Bahia <ronaldo@jobconvo.com> - 2015-09-15 09:28 -0700

csiph-web