Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-11-2010, 01:54 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 24
Default Help with UIScrollView

My objective is simple. Display an image that is 320x2000. User will scroll down the image, no zooming required.

I'm having a lot of problems with this.

In Interface Builder I made a scroll view, set it to 320x2000. I put an image view inside of it, specified my image for the image view.

in my .m file i have:

#import "TestViewViewController.h"

@implementation TestViewViewController

@synthesize scrollView2;

- (void)viewdidLoad
{

[scrollView2 setContentSize:CGSizeMake(320, 2000)];

}



What else am i missing?
Shlice Ideas is offline   Reply With Quote
Old 02-11-2010, 01:56 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

Is the UIImageView 320x2000?
harrytheshark is offline   Reply With Quote
Old 02-11-2010, 02:02 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 24
Default

Quote:
Originally Posted by harrytheshark View Post
Is the UIImageView 320x2000?
Yes
Shlice Ideas is offline   Reply With Quote
Old 02-11-2010, 02:03 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

And everything is hooked up correctly in IB?
harrytheshark is offline   Reply With Quote
Old 02-11-2010, 02:04 PM   #5 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 24
Default

Quote:
Originally Posted by harrytheshark View Post
And everything is hooked up correctly in IB?
What do I need to connect in IB. I have nothing connected now.
Shlice Ideas is offline   Reply With Quote
Old 02-11-2010, 02:07 PM   #6 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

You need to connect the UIScrollView to "scrollView2".

Your .h file should look something like:
Code:
#import <UIKit/UIKit.h>

@interface TheUIViewController : UIViewController {

    UIScrollView * scrollview2;

}

@property (nonatomic, retain) IBOutlet UIScrollView * scrollview2;

@end
harrytheshark is offline   Reply With Quote
Old 02-11-2010, 02:12 PM   #7 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 24
Default

Here is what I have:

MEGAUPLOAD - The leading online storage and file delivery service
Shlice Ideas is offline   Reply With Quote
Old 02-11-2010, 02:32 PM   #8 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,886
Default

Right. A few things.
when the view loaded, viewDidLoad is called, not viewdidload (case sensitive).

Another thing. The "view" outlet needs to be set to the UIView, not the UIImageView.

In the .h file, you should have:
Code:
@interface TestViewViewController : UIViewController {
	
	UIScrollView *scrollView2;	
}

@property (nonatomic, retain) IBOutlet UIScrollView * scrollView2;

@end
What I gave you was just an example, not literally what it should be. Sorry for the confusion.

In IB, you then need to hook up the "scrollView2" outlet from "File's Owner" to the UIScrollView.

You also need to make sure that the UIScrollView is only 480 pixels high. Otherwise it won't scroll.

Tom
harrytheshark is offline   Reply With Quote
Old 02-11-2010, 03:43 PM   #9 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 24
Default

Quote:
Originally Posted by harrytheshark View Post
Right. A few things.
when the view loaded, viewDidLoad is called, not viewdidload (case sensitive).

Another thing. The "view" outlet needs to be set to the UIView, not the UIImageView.

In the .h file, you should have:
Code:
@interface TestViewViewController : UIViewController {
	
	UIScrollView *scrollView2;	
}

@property (nonatomic, retain) IBOutlet UIScrollView * scrollView2;

@end
What I gave you was just an example, not literally what it should be. Sorry for the confusion.

In IB, you then need to hook up the "scrollView2" outlet from "File's Owner" to the UIScrollView.

You also need to make sure that the UIScrollView is only 480 pixels high. Otherwise it won't scroll.

Tom
Ok I will try it when I get back home. Thank you.
Shlice Ideas is offline   Reply With Quote
Old 02-11-2010, 06:14 PM   #10 (permalink)
Elegance is Infinite
iPhone Dev SDK Supporter
 
TapTouchClick's Avatar
 
Join Date: Jan 2010
Location: Bay Area, CA
Posts: 677
Send a message via AIM to TapTouchClick Send a message via Skype™ to TapTouchClick
Default

when i make scroll views i do

myScrollView.frame = CGRectMake (x,y,width,height);

is that wrong?
I see you using

[myScrollView setContentSize:CGSizeMake(320, 2000)];

Thanks
__________________
Our website
TapTouchClick is offline   Reply With Quote
Old 02-12-2010, 07:39 PM   #11 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 24
Default

Okay, this is my code in my .m file:

#import "TestViewViewController.h"

@implementation TestViewViewController

@synthesize scrollView2;

- (void)viewDidLoad
{


[scrollView2 setContentSize:CGSizeMake(320, 2000)];
[scrollView2 setScrollEnabled:YES];

}


And it's returning an error on the @synthesize line saying "No declaration of property "scrollView2" found in the interface
Shlice Ideas is offline   Reply With Quote
Old 02-12-2010, 08:44 PM   #12 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 24
Default

K, i figured it out :-)
Shlice Ideas is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 247
22 members and 225 guests
@sandris, ADY, beleg_1998, Dani77, diyora, FAED, fredidf, F_Bryant, iDifferent, JamesCahall, JasonR, mer10, Oral B, prchn4christ, smithdale87, Speed, spiderguy84, stekki, tgjorgoski, Touchmint, twerner, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,755
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:08 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0