0

I want to make landscape and portrait mode iOS app. I've designed one page with 3 text boxes and 7 buttons. Text boxes and button are resizing (change width) according to IOS screen size in landscape mode but scroller is not showing in landscape mode. So, some buttons are not showing in landscape mode. Please go through landscape Image and portrait Image links.

Landscape Image : http://www.2shared.com/photo/nButg4eb/landscape.html

Portrait Image: http://www.2shared.com/photo/1PR86npE/Portrait.html

I am new in IOS so, i am facing this type of problem. I request all experts to don't close my question because I am really facing this problem and i need to do complete it today.

I am waiting for your valuable answer.

Thanks! Shailesh Prajapati

user7388
  • 1,741
  • 2
  • 19
  • 25
Shailesh
  • 109
  • 1
  • 1
  • 7

2 Answers2

0

First of all, by default scroller is not always visible. It is visible when you enter your view but then it disappears. What is more it is not best, from user experience point of view, to display them all the time.

So, to indicate to user that "somewhere at the bottom there is something" you can do this two things:

after your view was loaded in - (void) viewDidLoad you can blink with scrolls by using:

[scrollView flashScrollIndicators];

and also you can place your buttons, near the bottom edge, in such a way that half of button will be visible and half will not. That will be indicator to user "hey! there is something there!" (https://i.stack.imgur.com/sZTuU.jpg)

lvp
  • 2,078
  • 18
  • 24
  • Hi, Thank you very much for your kind reply. I've used your code but i am getting below errors. 1. Unknown receiver scrollView; Did you mean UIScrollView 2. No known class method for selector flashScrollIndicators. – Shailesh May 10 '13 at 08:44
  • where I typed "scrollView" you should put name of your scrollView object (or outlet if you are using Storyboards) – lvp May 10 '13 at 08:51
  • Hi, Can you please explain me in detail because i am beginner in IOS development. Your help will be really appreciated. Thanks – Shailesh May 10 '13 at 09:01
  • can you put here your code first? Especially lines that are describing you scrollView – lvp May 10 '13 at 09:18
  • Hi, Let me explain you what i actually want. My screen contains 10 textbooks. Each text box Size is 300 x 30 (Width * height) and 10px spacing in left, right , top and bottom between each text box. It looks fine in portrait mode but when i change in landscape mode then all text-boxes size change to 460 * 30. So, in landscape mode it shows only 8 text boxes. So, I want to set scroller in landscape mode so, when user change mobile to landscape mode then it looks fine. Does it make sense. Thanks! – Shailesh May 10 '13 at 09:55
  • Embed your text boxes in UIScrollView, that's the solution. Scroll bar will be added automatically. – lvp May 10 '13 at 10:01
  • Hi Ivp, Check out landscape and portrait images here. http://www.2shared.com/photo/6Bmhc2bG/Landscape1.html http://www.2shared.com/photo/CUvVx4Bf/Portrait1.html You can see width change in landscape mode but it showing only 8 text boxes and i want to show all 10 text boxes with scroller. Thanks! – Shailesh May 10 '13 at 10:07
  • Yes, I know what you want to achieve. And solution for this is to embed all your text boxes into UIScrollView. So on blank UIView put UIScrollView and then Text boxes. You can scroll on iPhone simulator by swiping with three fingers on your touchpad(macbook's). – lvp May 10 '13 at 10:20
  • Wow :) Your suggestion works for me. Thanks lot Ivp. I've one question regarding show and hide scroller. As you know when mouse up and down then screen scroll and scroller show So, is it possible to show scroller visible automatically in landscape mode. I really appreciate if you help me. Thanks lot. – Shailesh May 10 '13 at 11:02
  • "So, is it possible to show scroller visible automatically in landscape mode." Yes, it is possible. Implement in your View Controller this method: `-(void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration { if ((orientation == UIInterfaceOrientationLandscapeLeft) || (orientation == UIInterfaceOrientationLandscapeRight)) { NSLog@"I'm in landscape!"); } }` P.S I would be grateful if you can set my answer as accepted (white tick on the left side of answer). – lvp May 10 '13 at 11:05
  • Hi Ivp, Thanks lot for your kind reply. Yes i will definitely accept your answer. I've used your code but scroll is not showing visible by default. It only shows when I up or down screen using mouse. Thanks – Shailesh May 10 '13 at 11:21
  • Thanks :) Replace `NSLog@"I'm in landscape!");` with `[name_of_your_scrollView flashScrollIndicators];`. Now when you rotate to Landscape scrollView should blink and disappear. – lvp May 10 '13 at 11:27
  • Hi, Thanks for your kind reply. I've put your code but scroll view is not showing. Is it not possible to set time? Thanks! – Shailesh May 10 '13 at 11:30
0

if this app for ios 6 or later in that case you can use autolayout otherwise it should be manage your code manually. First check is it portrait or landscape and then manage your text field and button manully according to frame.

Read first these two tutorial for autolayout..

  1. http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2

  2. http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2

Dharmbir Singh
  • 17,485
  • 5
  • 50
  • 66
  • Hi Dharmbir, I am shailesh. I've disabled autolayout because in autolayout textbox size is not changing in landcope mode. I've also sent you mail. – Shailesh May 10 '13 at 08:47
  • you can change the size of text field in both mode using autolayout coz im so familiar with autolayout.And i can't open mail in office. – Dharmbir Singh May 10 '13 at 08:58
  • Hi, Can you please tell me how to change size in landscape mode because. Do we need to right code for this? Thanks – Shailesh May 10 '13 at 09:00
  • you can fix leading and trailing contraint to superview.And no need to set width. – Dharmbir Singh May 10 '13 at 09:02
  • Add see my edited answer for autolayout.So please first read these two tutorial. – Dharmbir Singh May 10 '13 at 09:08
  • And third solution is you can set content size of scrollview in landscape mode. like this [self.scrollView setContentSize:CGSizeMake(320,1000)]; – Dharmbir Singh May 10 '13 at 09:23
  • Hi Dharmbir, Let me explain you what i actually want. My screen contains 10 textbooks. Each text box Size is 300 x 30 (Width * height) and 10px spacing in left, right , top and bottom between each text box. It looks fine in portrait mode but when i change in landscape mode then all text-boxes size change to 460 * 30. So, in landscape mode it shows only 8 text boxes. So, I want to set scroller in landscape mode so, when user change mobile to landscape mode then it looks fine. Does it make sense. Thanks! – Shailesh May 10 '13 at 09:53
  • Hi Dharmbir, Check out landscape and portrait images here... http://www.2shared.com/photo/6Bmhc2bG/Landscape1.html http://www.2shared.com/photo/CUvVx4Bf/Portrait1.html You can see width change in landscape mode but it showing only 8 text boxes and i want to show all 10 text boxes with scroller. Thanks! – Shailesh May 10 '13 at 10:06