iOS - UIScrollView not scrolling, though scroll bar is shown
up vote
0
down vote
favorite
I have a Scroll View, and inside it a UIView called "Content View", that contains all of my elements.
The Content view is equal to the Scroll view's top, bottom, leading and trailing. Also equal its width & height.
I also added self.scrollView.contentSize = self.contentView.frame.size
in ViewDidLoad.
When I scroll I can see a scroll bar going up and down on the side, and it seems like the page length is correct according to the bar, but the content itself does not scroll as you can see here:
What am I doing wrong?
Thanks!
ios objective-c xcode uiscrollview interface-builder
|
show 7 more comments
up vote
0
down vote
favorite
I have a Scroll View, and inside it a UIView called "Content View", that contains all of my elements.
The Content view is equal to the Scroll view's top, bottom, leading and trailing. Also equal its width & height.
I also added self.scrollView.contentSize = self.contentView.frame.size
in ViewDidLoad.
When I scroll I can see a scroll bar going up and down on the side, and it seems like the page length is correct according to the bar, but the content itself does not scroll as you can see here:
What am I doing wrong?
Thanks!
ios objective-c xcode uiscrollview interface-builder
1
It Seems the content is not inside the scrollView. The scrollView is on top of contentView, Check the view hierarchy
– Janmenjaya
Nov 19 at 11:57
can you remove safe area from the scroll view once and try?
– Aakash
Nov 19 at 11:58
I agree with @Janmenjaya please post your full view hierarchy
– Reinier Melian
Nov 19 at 12:04
@Janmenjaya I posted the full hierarchy, you can see the content view is indented under the scroll view.
– Rotem Yakov
Nov 19 at 12:41
@Aakash how can I delete a safe area?
– Rotem Yakov
Nov 19 at 12:42
|
show 7 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a Scroll View, and inside it a UIView called "Content View", that contains all of my elements.
The Content view is equal to the Scroll view's top, bottom, leading and trailing. Also equal its width & height.
I also added self.scrollView.contentSize = self.contentView.frame.size
in ViewDidLoad.
When I scroll I can see a scroll bar going up and down on the side, and it seems like the page length is correct according to the bar, but the content itself does not scroll as you can see here:
What am I doing wrong?
Thanks!
ios objective-c xcode uiscrollview interface-builder
I have a Scroll View, and inside it a UIView called "Content View", that contains all of my elements.
The Content view is equal to the Scroll view's top, bottom, leading and trailing. Also equal its width & height.
I also added self.scrollView.contentSize = self.contentView.frame.size
in ViewDidLoad.
When I scroll I can see a scroll bar going up and down on the side, and it seems like the page length is correct according to the bar, but the content itself does not scroll as you can see here:
What am I doing wrong?
Thanks!
ios objective-c xcode uiscrollview interface-builder
ios objective-c xcode uiscrollview interface-builder
edited Nov 19 at 13:48
asked Nov 19 at 11:54
Rotem Yakov
4118
4118
1
It Seems the content is not inside the scrollView. The scrollView is on top of contentView, Check the view hierarchy
– Janmenjaya
Nov 19 at 11:57
can you remove safe area from the scroll view once and try?
– Aakash
Nov 19 at 11:58
I agree with @Janmenjaya please post your full view hierarchy
– Reinier Melian
Nov 19 at 12:04
@Janmenjaya I posted the full hierarchy, you can see the content view is indented under the scroll view.
– Rotem Yakov
Nov 19 at 12:41
@Aakash how can I delete a safe area?
– Rotem Yakov
Nov 19 at 12:42
|
show 7 more comments
1
It Seems the content is not inside the scrollView. The scrollView is on top of contentView, Check the view hierarchy
– Janmenjaya
Nov 19 at 11:57
can you remove safe area from the scroll view once and try?
– Aakash
Nov 19 at 11:58
I agree with @Janmenjaya please post your full view hierarchy
– Reinier Melian
Nov 19 at 12:04
@Janmenjaya I posted the full hierarchy, you can see the content view is indented under the scroll view.
– Rotem Yakov
Nov 19 at 12:41
@Aakash how can I delete a safe area?
– Rotem Yakov
Nov 19 at 12:42
1
1
It Seems the content is not inside the scrollView. The scrollView is on top of contentView, Check the view hierarchy
– Janmenjaya
Nov 19 at 11:57
It Seems the content is not inside the scrollView. The scrollView is on top of contentView, Check the view hierarchy
– Janmenjaya
Nov 19 at 11:57
can you remove safe area from the scroll view once and try?
– Aakash
Nov 19 at 11:58
can you remove safe area from the scroll view once and try?
– Aakash
Nov 19 at 11:58
I agree with @Janmenjaya please post your full view hierarchy
– Reinier Melian
Nov 19 at 12:04
I agree with @Janmenjaya please post your full view hierarchy
– Reinier Melian
Nov 19 at 12:04
@Janmenjaya I posted the full hierarchy, you can see the content view is indented under the scroll view.
– Rotem Yakov
Nov 19 at 12:41
@Janmenjaya I posted the full hierarchy, you can see the content view is indented under the scroll view.
– Rotem Yakov
Nov 19 at 12:41
@Aakash how can I delete a safe area?
– Rotem Yakov
Nov 19 at 12:42
@Aakash how can I delete a safe area?
– Rotem Yakov
Nov 19 at 12:42
|
show 7 more comments
2 Answers
2
active
oldest
votes
up vote
1
down vote
The Content view is equal to the Scroll view's top, bottom, leading
and trailing. Also equal its width & height.
You need to remove the width and height constraints. Top, bottom, leading and trailing should stay. Also, remove that contentSize setting from viewDidLoad.
I assume you want vertical scroll. In that case, you should set contentView's width constraint to be equal to View's width (not scrollView's but View's which is the root of the hierarchy).
That should do the trick, assuming that vertical constraints of contentView's children are properly set up.
add a comment |
up vote
0
down vote
accepted
The 1st thing I had to do is what user3199693 said: remove that line from viewDidLoad (that made the wrong scroll bar I saw to go away). Also I set contentView's width constraint to be equal to top View's width, as he said.
That was good, but still didn't solve the problem. What did help was equal the height of the content view with top view.
Got the idea from here.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
The Content view is equal to the Scroll view's top, bottom, leading
and trailing. Also equal its width & height.
You need to remove the width and height constraints. Top, bottom, leading and trailing should stay. Also, remove that contentSize setting from viewDidLoad.
I assume you want vertical scroll. In that case, you should set contentView's width constraint to be equal to View's width (not scrollView's but View's which is the root of the hierarchy).
That should do the trick, assuming that vertical constraints of contentView's children are properly set up.
add a comment |
up vote
1
down vote
The Content view is equal to the Scroll view's top, bottom, leading
and trailing. Also equal its width & height.
You need to remove the width and height constraints. Top, bottom, leading and trailing should stay. Also, remove that contentSize setting from viewDidLoad.
I assume you want vertical scroll. In that case, you should set contentView's width constraint to be equal to View's width (not scrollView's but View's which is the root of the hierarchy).
That should do the trick, assuming that vertical constraints of contentView's children are properly set up.
add a comment |
up vote
1
down vote
up vote
1
down vote
The Content view is equal to the Scroll view's top, bottom, leading
and trailing. Also equal its width & height.
You need to remove the width and height constraints. Top, bottom, leading and trailing should stay. Also, remove that contentSize setting from viewDidLoad.
I assume you want vertical scroll. In that case, you should set contentView's width constraint to be equal to View's width (not scrollView's but View's which is the root of the hierarchy).
That should do the trick, assuming that vertical constraints of contentView's children are properly set up.
The Content view is equal to the Scroll view's top, bottom, leading
and trailing. Also equal its width & height.
You need to remove the width and height constraints. Top, bottom, leading and trailing should stay. Also, remove that contentSize setting from viewDidLoad.
I assume you want vertical scroll. In that case, you should set contentView's width constraint to be equal to View's width (not scrollView's but View's which is the root of the hierarchy).
That should do the trick, assuming that vertical constraints of contentView's children are properly set up.
answered Nov 19 at 21:41
user3199693
5339
5339
add a comment |
add a comment |
up vote
0
down vote
accepted
The 1st thing I had to do is what user3199693 said: remove that line from viewDidLoad (that made the wrong scroll bar I saw to go away). Also I set contentView's width constraint to be equal to top View's width, as he said.
That was good, but still didn't solve the problem. What did help was equal the height of the content view with top view.
Got the idea from here.
add a comment |
up vote
0
down vote
accepted
The 1st thing I had to do is what user3199693 said: remove that line from viewDidLoad (that made the wrong scroll bar I saw to go away). Also I set contentView's width constraint to be equal to top View's width, as he said.
That was good, but still didn't solve the problem. What did help was equal the height of the content view with top view.
Got the idea from here.
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
The 1st thing I had to do is what user3199693 said: remove that line from viewDidLoad (that made the wrong scroll bar I saw to go away). Also I set contentView's width constraint to be equal to top View's width, as he said.
That was good, but still didn't solve the problem. What did help was equal the height of the content view with top view.
Got the idea from here.
The 1st thing I had to do is what user3199693 said: remove that line from viewDidLoad (that made the wrong scroll bar I saw to go away). Also I set contentView's width constraint to be equal to top View's width, as he said.
That was good, but still didn't solve the problem. What did help was equal the height of the content view with top view.
Got the idea from here.
edited Nov 22 at 10:59
answered Nov 20 at 14:26
Rotem Yakov
4118
4118
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53374095%2fios-uiscrollview-not-scrolling-though-scroll-bar-is-shown%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
It Seems the content is not inside the scrollView. The scrollView is on top of contentView, Check the view hierarchy
– Janmenjaya
Nov 19 at 11:57
can you remove safe area from the scroll view once and try?
– Aakash
Nov 19 at 11:58
I agree with @Janmenjaya please post your full view hierarchy
– Reinier Melian
Nov 19 at 12:04
@Janmenjaya I posted the full hierarchy, you can see the content view is indented under the scroll view.
– Rotem Yakov
Nov 19 at 12:41
@Aakash how can I delete a safe area?
– Rotem Yakov
Nov 19 at 12:42