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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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 07-15-2010, 11:31 AM   #1 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 65
joec is on a distinguished road
Default UIScrollView will not scroll

Hi

So, i have a view controller which contains just a scroll view. In viewDidLoad, i add a view to it from a nib, but when i do that, the scrolling stops working. The view i added works though, i.e. i can click buttons, but half of it is off screen.
Code:
@implementation JCEKScrollViewController_iPhone
@synthesize scrollView;
- (void)viewDidLoad {
    scrollView.backgroundColor = [UIColor redColor];
    scrollView.delegate = self;

    NSArray *nibParts = [[NSBundle mainBundle] loadNibNamed:@"JCEKKeyboard" 
                                                  owner:self 
                                                options:nil];
//first object is the view
    UIView *keyboard = [nibParts objectAtIndex:0];


    scrollView.contentSize = CGSizeMake(1000, 320);
    [scrollView setAutoresizesSubviews:YES];
    [scrollView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];

    [keyboard setAutoresizesSubviews:YES];
    [keyboard setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];


    [scrollView addSubview:keyboard];


}
Thanks
Joe
joec is offline   Reply With Quote
Old 07-15-2010, 01:42 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Long Beach, CA
Posts: 612
bytor99999 is on a distinguished road
Send a message via AIM to bytor99999 Send a message via Yahoo to bytor99999
Default

I think this is why

scrollView.contentSize = CGSizeMake(1000, 320);

Isn't that making the contentSize be smaller than the view size, therefore making no part of it outside what is viewable and therefore no longer needing to scroll. Oh, wait I am assuming iPad and it this is iPhone, then yes it will be bigger than the view size. Then just ignore my post here.

contentSize is the full size of the scroll view, and if it is bigger than what can be visible, that is when it automatically makes it scroll.

Mark
__________________
Perfect World Programming LLC
http://www.perfectworldprogramming.com

Please check out my apps.

TubeOrganizer
http://www.spritzlerapps.com/tube-organizer.html

Paper Clips
http://spritzlerapps.weebly.com/paper-clips.html

Last edited by bytor99999; 07-15-2010 at 01:43 PM. Reason: Typo
bytor99999 is offline   Reply With Quote
Old 07-15-2010, 02:02 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 65
joec is on a distinguished road
Default

Yeah i should have been clear - its for the iPhone. So the scroll view is bigger than the view - view is 900 wide x 320 high
joec is offline   Reply With Quote
Old 07-15-2010, 02:25 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2009
Location: Benicia, CA
Age: 50
Posts: 152
That Don Guy is on a distinguished road
Default

You have your ScrollView's autoresizesSubviews set to YES. Is it possible that, when you add your keyboard subview, it is being resized to fit the ScrollView? (Then again, that should make them both bigger than the ScrollView's parent view, so scrolling should still be enabled.)

The only other thing I can think of off the top of my head is that, for some reason, keyboard has its exclusiveTouch property set to YES. Since it is supposed to default to NO, maybe you mistakenly set the property in Interface Builder when you created the nib?

-- Don
That Don Guy is offline   Reply With Quote
Old 07-16-2010, 03:56 AM   #5 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 65
joec is on a distinguished road
Default

The keyboard nib has got exclusive touch set to NO. Changing the autoresizesSubviews doesnt seem to make a difference.

If i create the view programmatically i.e.

Code:
UIView *view = [[UIView] alloc] initWithFrame: ......]]
then the view gets added and the scrolling works.

Seems to be a problem with loading the nib using loadNibNamed:

Any ideas?

Thanks
Joe
joec is offline   Reply With Quote
Reply

Bookmarks

Tags
load from nib, uiscrollview

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: 332
14 members and 318 guests
akphyo, alexP, appservice, cgokey, EXOPTENDAELAX, flamingliquid, guusleijsten, mariano_donati, ohmniac, Paul Slocum, PavelSea, SLIC, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,653
Threads: 94,115
Posts: 402,888
Top Poster: BrianSlick (7,990)
Welcome to our newest member, ohmniac
Powered by vBadvanced CMPS v3.1.0

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