• 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: Accessing items in a UIScrollView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing items in a UIScrollView?


  • Subject: Re: Accessing items in a UIScrollView?
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Fri, 30 Jul 2010 16:28:57 -0400

Thanks - I'm just using a NSMutable array now and doing it that way which
works great.

On Fri, Jul 30, 2010 at 3:30 PM, Fritz Anderson <email@hidden>wrote:

> On 30 Jul 2010, at 2:14 PM, Eric E. Dolecki wrote:
>
> > -(void) buttonClicked:(id)sender
> > {
> >    int tag = [sender tag];
> >
> >    for(int i=0;i<20;i++){
> >        BasicListItem *tmp = (BasicListItem*)[scrollView viewWithTag:i];
> >
> >        if( tag != i ){
> >            [tmp setState:NO]; //Barf here
> >        }
> >    }
> >    NSLog(@"%d",tag);
> > }
> >
> >
> > *** Terminating app due to uncaught exception
> 'NSInvalidArgumentException',
> > reason: '-[UIScrollView setState:]: unrecognized selector sent to
> instance
> > 0x593e820'
> >
> >
> > How can I dig into the scrollview and access those BasicListItem objects?
>
> 1. Use the blasted NSArray. It's a data structure that accesses a group of
> objects in order, by a numeric index, and can be efficiently iterated.
> That's what you want.
>
> -(void) buttonClicked: (id) sender
> {
>        for (BasicListItem * item in self.listItemArray)
>                item.state = (item == sender);
> }
>
> 2. This is what the documentation says -[UIView viewWithTag:] returns:
>
> > The view in the receiver’s hierarchy that matches tag. The receiver is
> included in the search.
>
> I assume you left the scroll view's tag at zero? The exception label is the
> clue: It says you sent setState: to the scroll view.
>
>        — F
>
>


--
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

References: 
 >Accessing items in a UIScrollView? (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Accessing items in a UIScrollView? (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Accessing items in a UIScrollView?
  • Next by Date: [iPhone] Nib Loading Question
  • Previous by thread: Re: Accessing items in a UIScrollView?
  • Next by thread: [iPhone] Nib Loading Question
  • Index(es):
    • Date
    • Thread