• 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
Odd question about UIViews in UIScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Odd question about UIViews in UIScrollView


  • Subject: Odd question about UIViews in UIScrollView
  • From: "Eric E. Dolecki" <email@hidden>
  • Date: Fri, 27 Aug 2010 09:23:43 -0400

I have a UIScrollView that I am placing custom UIViews into. Album covers
with metadata. Right now just for testing, when I create the UIView to add
to the scroll view, I am also setting an int variable in the UIView...

AlbumCover *lad = [[AlbumCover alloc] initWithFrame:CGRectMake(190, 5, 200,
200)];

[lad setAlbumCover:@"lad.jpg" firstLine:@"The Number of the Beast"
secondLine:@"Live After Death" thirdLine:@"Iron Maiden" isCurrent:NO
index:1];

covers = [[AlbumCoverDisplay alloc] initWithFrame:CGRectMake(0, 50, 320,
300)];

    [self.view addSubview:covers];

    [covers addAlbum:test];


Inside each album cover UIView I have declared an int in the .h called
myIndex. When the setAlbumCover method is called, I set myIndex = index. I
am logging the int value (which I've declared in my .h interface as it's set
by the method. These values are correct as I see them NSLogged.


The trouble is inside each AlbumCover view, I have a touchesBegan method
where I determine single or double touches. On a single I do:


NSLog(@"%d",myIndex);


Sometimes its correct, and sometimes it's off by one (if it was supposed to
be 0 it will log 1). So sometimes it's off by one (+). If I flip through
views in the scroll view (pagination enabled), a view that was reporting
correctly wlll report incorrectly when it comes back into view.


This is not going to be my final implementation (I plan on doing this in a
much better fashion), but wondering why. If I set tags the same way, they
too seem to get off by 1 (I trace [self tag] from within the album cover
itself and it can get screwed up too).


Is this a noob error on my part (I assume that it is)?




  Google Voice: (508) 656-0622
  Twitter: eric_dolecki      XBoxLive: edolecki      PSN: eric_dolecki
  http://blog.ericd.net
_______________________________________________

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: Odd question about UIViews in UIScrollView
      • From: "Eric E. Dolecki" <email@hidden>
  • Prev by Date: Re: How to change name and location of "core dump files"
  • Next by Date: Re: Odd question about UIViews in UIScrollView
  • Previous by thread: Re: How to set focus on NSMenu (make it get key events)?
  • Next by thread: Re: Odd question about UIViews in UIScrollView
  • Index(es):
    • Date
    • Thread