• 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: passing an object between views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: passing an object between views


  • Subject: Re: passing an object between views
  • From: John Greene <email@hidden>
  • Date: Wed, 20 Aug 2008 10:50:42 -0700

Ah, reasonably better!  Now I have:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
            if(dvController == nil)
            {
                    theaterDetailController *aController = [[theaterDetailController alloc] initWithNibName:@"theaterDetailView" bundle:nil];
                    self.dvController = aController;
                    [aController release];
            }
            [dvController setTableData:[items objectAtIndex:indexPath.row]];
            [dvController updateRowNumber:indexPath.row];
            [[self navigationController] pushViewController:dvController animated:YES];
    }


 and the method:

    -(void)setTableData:(NSDictionary *)myTheater {
            NSLog(@"myTheater is %@", myTheater);
    }


It compiles and runs, but the object myTheater is empty according to
NSLog.  Is there something obvious that I'm doing wrong?

John


Michael Ash wrote:
> On Wed, Aug 20, 2008 at 12:47 PM, John Greene <email@hidden> wrote:
>
>> I've tried a couple of things to make the object available to
>> theaterDetailController with no success:
>>
>>    * Creating a method:
>>
>>        -(void)setTableData:(NSDictionary)myTheater {
>>                                                    NSLog(@"myTheater is ", myTheater);
>>        }
>>
>>
>>        Which throws "can not use an object as parameter to a method",
>>        hence my "language forbids it" remark.
>>
>
> The language forbids passing objects by value. You must pass it by
> reference. NSDictionary *, not just NSDictionary.
>
>
>>    * Setting a property of dvController directly:
>>
>>         dvController.items = items;
>>
>>
>>        Which throws "request for member 'items' in something not a
>>        structure or union".
>>
>
> The language forbids setting a property if you haven't declared one,
> either using @property or by declaring a getter/setter pair. It also
> forbids setting a property using a pointer declared to be of type
> "id". Either one of these could be your problem.
>
> Mike
> _______________________________________________
>
> 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
>
_______________________________________________

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: passing an object between views
      • From: John Greene <email@hidden>
References: 
 >passing an object between views (From: John Greene <email@hidden>)
 >Re: passing an object between views (From: Graham Cox <email@hidden>)
 >Re: passing an object between views (From: John Greene <email@hidden>)
 >Re: passing an object between views (From: "Michael Ash" <email@hidden>)

  • Prev by Date: Re: Simple NSView Question
  • Next by Date: Re: Simple NSView Question
  • Previous by thread: Re: passing an object between views
  • Next by thread: Re: passing an object between views
  • Index(es):
    • Date
    • Thread