• 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: Scroll Views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scroll Views


  • Subject: Re: Scroll Views
  • From: Development <email@hidden>
  • Date: Fri, 21 Sep 2007 20:46:35 -0700

I don't think a matrix would work would it? It wouldn't allow me to scroll through...

However... It took some time but between my books and the developer site i did finally get the scrollview to work the way I wanted. I have included the working code on the chance that some one with the same problem searches the list archive. This is just code I used to figure out the scroll view. The actual program will get images from a folder.

-(void)awakeFromNib
{

	[scroller setHasVerticalScroller:YES];
	NSString * imagePath =@"/Users/fns/Pictures/DSCF0019.JPG";


int n = 0;
float top = (10.0*140.0);
NSRect scf = [scrollClip frame];
[scrollClip setFrame:NSMakeRect(scf.origin.x,scf.origin.y,150.0,top)];
while(n < 10){

ThumbNail * thisThumb =[[ThumbNail alloc]initWithFile:imagePath originx:5.0 originy:(top -140)];
[scrollClip addSubview:[thisThumb thumbNailImage]];
top -=140;
n++;
}
[scroller setDocumentView:scrollClip];
NSPoint newOrigin = NSMakePoint(0.0,NSMaxY([[scroller documentView] frame])-NSHeight([[scroller contentView]bounds]));


float height = NSHeight([[scroller contentView]bounds]);
float width = NSWidth([[scroller contentView]bounds]);
[[scroller contentView] scrollRectToVisible:NSMakeRect (newOrigin.x,newOrigin.y,width,height)];
NSPoint csp=[[scroller contentView] bounds].origin;
}
_______________________________________________


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: 
 >Scroll Views (From: Development <email@hidden>)
 >Re: Scroll Views (From: Dave Hersey <email@hidden>)

  • Prev by Date: Re: NSArray - move Items at indexes
  • Next by Date: Re: Using NSDocument w/o always displaying the document window
  • Previous by thread: Re: Scroll Views
  • Next by thread: Re: Scroll Views
  • Index(es):
    • Date
    • Thread