• 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: noob: Question about senders and views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: noob: Question about senders and views


  • Subject: Re: noob: Question about senders and views
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Wed, 8 Apr 2009 13:58:30 -0400

How can I make FirstViewController aware of the method in the second class?
I tried import and still got a warning.
FirstViewController.m

#import "FirstViewController.h"

#import "SecondViewController.h"


-(IBAction)buttonDown:(id)sender {

NSLog(@"id: %d", [sender tag] );

[SecondViewController populateTextFieldWithString:@"hey there"];

}


SecondViewController.m


-(void)populateTextFieldWithString:(NSString *)string {

NSLog(@"%@", string );

[commandText setText:string];

}

As soon as I call that method the app bombs... it has no idea what that
method in the SecondViewController is...




On Wed, Apr 8, 2009 at 1:27 PM, Craig Williams <email@hidden>wrote:

>
> On Apr 8, 2009, at 11:08 AM, Eric E. Dolecki wrote:
>
>  I have a tab bar and it's driven by FirstViewController. I have a second
>> view with it's own xib. I can have buttons there call into a "buttonPress"
>> method I have in the FirstViewController. I am able to get the sender tag
>> easily.
>>
>> NSLog(@"id: %d", [sender tag] );
>>
>>
>> However in the second xib I have a text field that I want to populate with
>> a
>> string. Since the buttonPress method in the FirstViewController doesn't
>> know
>> about the UILabel in the SecondViewController, how can I have it set that
>> field?
>>
>> Eric
>>
>
> Have you considered sending the string along with the button click call and
> having
> the SecondViewController populate its own text field?
>
> -(IBAction)buttonClicked:(id)sender
> {
>        [secondViewController populateTextFieldWithString:@"TextField
> String"];
> }
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>



--
http://ericd.net
Interactive design and development
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: noob: Question about senders and views
      • From: "I. Savant" <email@hidden>
References: 
 >noob: Question about senders and views (From: "Eric E. Dolecki" <email@hidden>)
 >Re: noob: Question about senders and views (From: Craig Williams <email@hidden>)

  • Prev by Date: Re: Simple printing hangs
  • Next by Date: Re: noob: Question about senders and views
  • Previous by thread: Re: noob: Question about senders and views
  • Next by thread: Re: noob: Question about senders and views
  • Index(es):
    • Date
    • Thread