Discussion Forums  >  Uncategorized

Replies: 4    Views: 437

macg4
Apple Fan
Profile
Posts: 8
Reg: Sep 01, 2011
location unknow...
80
09/08/11 02:40 PM (14 years ago)

Button menu scrolling issues in portrait and landscape iPhone orientations.

I have 10 Menu Buttons in my iPhone app. Layout Style: Grid, Button Size: 160, Button Margin: 0 In portrait iPhone orientation I can scroll to the very bottom row of buttons and even more - there is a blank unneeded space in the bottom of the screen. However in landscape iPhone orientation I can scroll only a little bit - I can't reach the 2 bottom rows of buttons. I can fix scrolling and remove unneeded space in portrait iPhone orientation by entering -220 in the code line line 407 in BT_screen_menuButtons.m: self.myScrollView.contentSize = CGSizeMake(contentWidth, contentHeight-220); But it affects scrolling in landscape iPhone orientation too - I can't scroll at all in landscape orientation then. Is there any way to fix button menu scrolling in both iPhone orientations?
 
Parker @ buzztouch
buzztouch Evangelist
Profile
Posts: 1395
Reg: May 09, 2011
Pacific Grove, ...
24,500
like
09/08/11 02:55 PM (14 years ago)
Hey macg4, Check out this thread : http://www.buzztouch.com/forum/thread.php?tid=E45E2692EBE2BF5098667D5&status=&searchInput=Button&sortColumn=FT.dateStampUTC&sortUpDown=DESC¤tPage=1&doViews=1 It covers the same topic as yours and the logic to create an 'if' statement to check which device is running the app and to adjust the content height accordingly.
 
macg4
Apple Fan
Profile
Posts: 8
Reg: Sep 01, 2011
location unknow...
80
like
09/09/11 08:36 AM (14 years ago)
Thanks Parker, After some experiments my scrolling problem is fixed. My code: //grid if([buttonLayoutStyle isEqualToString:@grid] || [buttonLayoutStyle isEqualToString:@]){ contentWidth = deviceWidth; contentHeight = ((boxHeight + labelHeight) * (numButtons + 10)) / buttonsPerRow - (deviceHeight * 1.5); if(contentHeight < deviceHeight) contentHeight = (deviceHeight); if(contentHeight > deviceHeight) contentHeight = (deviceHeight + 380); } if([appDelegate.rootApp.rootDevice isIPad]){ self.myScrollView.contentSize = CGSizeMake(contentWidth, contentHeight + 70); }else{ self.myScrollView.contentSize = CGSizeMake(contentWidth, contentHeight); } Hope this will be usefull for someone.
 
Parker @ buzztouch
buzztouch Evangelist
Profile
Posts: 1395
Reg: May 09, 2011
Pacific Grove, ...
24,500
like
09/09/11 03:27 PM (14 years ago)
You the Man!!! Awesome job getting that to work, and thanks a million for sharing your code!
 
Njmpwnz
Apple Fan
Profile
Posts: 165
Reg: Feb 08, 2011
Cleves
2,350
like
05/17/12 04:36 AM (13 years ago)
I copied your code into Xcode and put //grid if([buttonLayoutStyle isEqualToString:@”grid”] || [buttonLayoutStyle isEqualToString:@””]){ contentWidth = deviceWidth; contentHeight = ((boxHeight + labelHeight) * (numButtons + 10)) / buttonsPerRow - (deviceHeight * 1.5); if(contentHeight < deviceHeight) contentHeight = (deviceHeight); if(contentHeight > deviceHeight) contentHeight = (deviceHeight + 380); } if([appDelegate.rootApp.rootDevice isIPad]){ self.myScrollView.contentSize = CGSizeMake(contentWidth, contentHeight + 70); }else{ self.myScrollView.contentSize = CGSizeMake(contentWidth, contentHeight); } I changed @grid to @"grid" and the @ at the end of that line to @"" so xcode would build it. Now I can't scroll at all
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.