ScrollView with embedded StackView issueoverlapping UIView issue using segmented controllerScrollview vertical and horizontal in androidHow to use ScrollView in Android?How Does Scrollview Work With Autolayout, and Why Does Setting the Bottom Vertical Space Constraint Make it Work?Android StackView inside ScrollViewsticky header with scrollView and stackviewSwift : Is it possible to add an empty stackview inside a scrollview?Xamarin iOS StackView ScrollViewEmbedded Stackviews triggering autolayout erroriOS Stackview inside ScrollView with preserve image aspect ratioxcode: stackview inside scrollview
Removing rows containing NA in every column
Why are there two bearded faces wearing red hats on my stealth bomber icon?
Other than good shoes and a stick, what are some ways to preserve your knees on long hikes?
Schelling's model of Segregation Python implementation with Geopandas (Follow-up)
Lead Amalgam as a Material for a Sword
Tips for remembering the order of parameters for ln?
Is there any reason nowadays to use a neon indicator lamp instead of a LED?
Is the name of an interval between two notes unique and absolute?
The relationship of noch nicht and the passive voice
Can one guy with a duplicator initiate a nuclear apocalypse?
Dead or alive (First time)
Why is it called a Blood Knot?
Why does Canada require a minimum rate of climb for ultralights of 300 ft/min?
Madrid to London w/ Expired 90/180 days stay as US citizen
Manager manipulates my leaves, what's in it for him?
Why do things cool down?
What is the word for a person who destroys monuments?
What was the deeper meaning of Hermione wanting the cloak?
Applications of mathematics in clinical setting
Decimal “XOR” operator
Changing States from child through parent while obeying SOLID principles
What's the word for a student who doesn't register but goes to a class anyway?
Twelve Minesweeper mines that make twelve 4s
Inquiry answerer
ScrollView with embedded StackView issue
overlapping UIView issue using segmented controllerScrollview vertical and horizontal in androidHow to use ScrollView in Android?How Does Scrollview Work With Autolayout, and Why Does Setting the Bottom Vertical Space Constraint Make it Work?Android StackView inside ScrollViewsticky header with scrollView and stackviewSwift : Is it possible to add an empty stackview inside a scrollview?Xamarin iOS StackView ScrollViewEmbedded Stackviews triggering autolayout erroriOS Stackview inside ScrollView with preserve image aspect ratioxcode: stackview inside scrollview
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a scrollView with a stackView placed in it. The scrollView is constrained to the rootview. The stack view will show a xib view.
The xib views are all different lengths.
The xib views are labeled simpleVC0 and simpleVC1. The length of the simpleVC0is 2500 and the length of simpleVC1 is 1000.
My problem is that when the xib views are presented in the stack view the length of the scrollView does not change to the length of the presented xib view.
It is like the xib view is presented but the scroll view is locked at a specific length.
Here is simpleVC0 xib view. followed by it when run. When I try to scroll it doesn't allow me to scroll to the bottom of the xib view. it seems to cut the xib view off at a certain length.
Am right in saying that this is possibly an issue that may have to be resolved in code? or can it it solved souled by the constraints.
I have tried auto layout constraints however they have not worked.





I have constrained the scrollView to the rootview on all four sides.
When the root view is loaded the xibs are established using the following code:
//Different subViews for ingredients and steps
if counter == 0
simpleViewX = SimpleVC0().view
simpleViewY = SimpleVC1().view
stack.addArrangedSubview(simpleViewX)
stack.addArrangedSubview(simpleViewY)
The views are the hidden shown by changing the value of the segmented view controller. Shown below:
@IBAction func tabselected(_ sender: Any)
switch (sender as AnyObject).selectedSegmentIndex
case 0:
simpleViewY.isHidden = true
simpleViewX.isHidden = false
break
case 1:
simpleViewX.isHidden = true
simpleViewY.isHidden = false
break
case 2:
//calledvideo in array is the value of the counter.
calledVideo = vids[counter]
geturl()
break
default:
break
xcode constraints scrollview stackview
add a comment
|
I have a scrollView with a stackView placed in it. The scrollView is constrained to the rootview. The stack view will show a xib view.
The xib views are all different lengths.
The xib views are labeled simpleVC0 and simpleVC1. The length of the simpleVC0is 2500 and the length of simpleVC1 is 1000.
My problem is that when the xib views are presented in the stack view the length of the scrollView does not change to the length of the presented xib view.
It is like the xib view is presented but the scroll view is locked at a specific length.
Here is simpleVC0 xib view. followed by it when run. When I try to scroll it doesn't allow me to scroll to the bottom of the xib view. it seems to cut the xib view off at a certain length.
Am right in saying that this is possibly an issue that may have to be resolved in code? or can it it solved souled by the constraints.
I have tried auto layout constraints however they have not worked.





I have constrained the scrollView to the rootview on all four sides.
When the root view is loaded the xibs are established using the following code:
//Different subViews for ingredients and steps
if counter == 0
simpleViewX = SimpleVC0().view
simpleViewY = SimpleVC1().view
stack.addArrangedSubview(simpleViewX)
stack.addArrangedSubview(simpleViewY)
The views are the hidden shown by changing the value of the segmented view controller. Shown below:
@IBAction func tabselected(_ sender: Any)
switch (sender as AnyObject).selectedSegmentIndex
case 0:
simpleViewY.isHidden = true
simpleViewX.isHidden = false
break
case 1:
simpleViewX.isHidden = true
simpleViewY.isHidden = false
break
case 2:
//calledvideo in array is the value of the counter.
calledVideo = vids[counter]
geturl()
break
default:
break
xcode constraints scrollview stackview
Show how are you loading the xib content.
– DonMag
Mar 28 at 15:23
@DonMag just updated it there to show how xibs are called.
– pete800
Mar 28 at 15:30
add a comment
|
I have a scrollView with a stackView placed in it. The scrollView is constrained to the rootview. The stack view will show a xib view.
The xib views are all different lengths.
The xib views are labeled simpleVC0 and simpleVC1. The length of the simpleVC0is 2500 and the length of simpleVC1 is 1000.
My problem is that when the xib views are presented in the stack view the length of the scrollView does not change to the length of the presented xib view.
It is like the xib view is presented but the scroll view is locked at a specific length.
Here is simpleVC0 xib view. followed by it when run. When I try to scroll it doesn't allow me to scroll to the bottom of the xib view. it seems to cut the xib view off at a certain length.
Am right in saying that this is possibly an issue that may have to be resolved in code? or can it it solved souled by the constraints.
I have tried auto layout constraints however they have not worked.





I have constrained the scrollView to the rootview on all four sides.
When the root view is loaded the xibs are established using the following code:
//Different subViews for ingredients and steps
if counter == 0
simpleViewX = SimpleVC0().view
simpleViewY = SimpleVC1().view
stack.addArrangedSubview(simpleViewX)
stack.addArrangedSubview(simpleViewY)
The views are the hidden shown by changing the value of the segmented view controller. Shown below:
@IBAction func tabselected(_ sender: Any)
switch (sender as AnyObject).selectedSegmentIndex
case 0:
simpleViewY.isHidden = true
simpleViewX.isHidden = false
break
case 1:
simpleViewX.isHidden = true
simpleViewY.isHidden = false
break
case 2:
//calledvideo in array is the value of the counter.
calledVideo = vids[counter]
geturl()
break
default:
break
xcode constraints scrollview stackview
I have a scrollView with a stackView placed in it. The scrollView is constrained to the rootview. The stack view will show a xib view.
The xib views are all different lengths.
The xib views are labeled simpleVC0 and simpleVC1. The length of the simpleVC0is 2500 and the length of simpleVC1 is 1000.
My problem is that when the xib views are presented in the stack view the length of the scrollView does not change to the length of the presented xib view.
It is like the xib view is presented but the scroll view is locked at a specific length.
Here is simpleVC0 xib view. followed by it when run. When I try to scroll it doesn't allow me to scroll to the bottom of the xib view. it seems to cut the xib view off at a certain length.
Am right in saying that this is possibly an issue that may have to be resolved in code? or can it it solved souled by the constraints.
I have tried auto layout constraints however they have not worked.





I have constrained the scrollView to the rootview on all four sides.
When the root view is loaded the xibs are established using the following code:
//Different subViews for ingredients and steps
if counter == 0
simpleViewX = SimpleVC0().view
simpleViewY = SimpleVC1().view
stack.addArrangedSubview(simpleViewX)
stack.addArrangedSubview(simpleViewY)
The views are the hidden shown by changing the value of the segmented view controller. Shown below:
@IBAction func tabselected(_ sender: Any)
switch (sender as AnyObject).selectedSegmentIndex
case 0:
simpleViewY.isHidden = true
simpleViewX.isHidden = false
break
case 1:
simpleViewX.isHidden = true
simpleViewY.isHidden = false
break
case 2:
//calledvideo in array is the value of the counter.
calledVideo = vids[counter]
geturl()
break
default:
break
xcode constraints scrollview stackview
xcode constraints scrollview stackview
edited Mar 28 at 15:29
pete800
asked Mar 28 at 14:15
pete800pete800
1043 silver badges15 bronze badges
1043 silver badges15 bronze badges
Show how are you loading the xib content.
– DonMag
Mar 28 at 15:23
@DonMag just updated it there to show how xibs are called.
– pete800
Mar 28 at 15:30
add a comment
|
Show how are you loading the xib content.
– DonMag
Mar 28 at 15:23
@DonMag just updated it there to show how xibs are called.
– pete800
Mar 28 at 15:30
Show how are you loading the xib content.
– DonMag
Mar 28 at 15:23
Show how are you loading the xib content.
– DonMag
Mar 28 at 15:23
@DonMag just updated it there to show how xibs are called.
– pete800
Mar 28 at 15:30
@DonMag just updated it there to show how xibs are called.
– pete800
Mar 28 at 15:30
add a comment
|
2 Answers
2
active
oldest
votes
To use a UIStackView with a UIScrollView you need to allow the stack view to expand its height based on its content.
When laying it out in storyboard, give the stack view a height constraint (to satisfy IB's requirements), but give that height constraint a low Priority.
Then, when adding arranged subviews, the stack view will grow vertically.
Here's a complete example, based on the images you've shown: https://github.com/DonMag/XIBsInScrollView
Thank you my man, you dont understand how much you have helped. Took me two days playing with it, no joke. Thanks again appreciate it.
– pete800
Mar 28 at 22:49
add a comment
|
You have to modify the contentSize property of your scrollView in the code. I don’t know how to deal with it with storyboards, but you can make an outlet of your scrollView and calculate the new height each times it changes (each time you add something or remove something in it)
scrollView.contentSize = CGSize(width:yourNewW, height:yourNewH)
Better to use auto-layout and constraints.
– DonMag
Mar 28 at 17:35
Honestly I gave up mixing scrollView with autolayout, it’s been a nightmare of bugs every-time when I tried. From my point of view it’s much more precise and effective to compute old plain coordinates when working with content of a scrollview
– Jerem Lachkar
Mar 28 at 17:37
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
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%2f55399808%2fscrollview-with-embedded-stackview-issue%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To use a UIStackView with a UIScrollView you need to allow the stack view to expand its height based on its content.
When laying it out in storyboard, give the stack view a height constraint (to satisfy IB's requirements), but give that height constraint a low Priority.
Then, when adding arranged subviews, the stack view will grow vertically.
Here's a complete example, based on the images you've shown: https://github.com/DonMag/XIBsInScrollView
Thank you my man, you dont understand how much you have helped. Took me two days playing with it, no joke. Thanks again appreciate it.
– pete800
Mar 28 at 22:49
add a comment
|
To use a UIStackView with a UIScrollView you need to allow the stack view to expand its height based on its content.
When laying it out in storyboard, give the stack view a height constraint (to satisfy IB's requirements), but give that height constraint a low Priority.
Then, when adding arranged subviews, the stack view will grow vertically.
Here's a complete example, based on the images you've shown: https://github.com/DonMag/XIBsInScrollView
Thank you my man, you dont understand how much you have helped. Took me two days playing with it, no joke. Thanks again appreciate it.
– pete800
Mar 28 at 22:49
add a comment
|
To use a UIStackView with a UIScrollView you need to allow the stack view to expand its height based on its content.
When laying it out in storyboard, give the stack view a height constraint (to satisfy IB's requirements), but give that height constraint a low Priority.
Then, when adding arranged subviews, the stack view will grow vertically.
Here's a complete example, based on the images you've shown: https://github.com/DonMag/XIBsInScrollView
To use a UIStackView with a UIScrollView you need to allow the stack view to expand its height based on its content.
When laying it out in storyboard, give the stack view a height constraint (to satisfy IB's requirements), but give that height constraint a low Priority.
Then, when adding arranged subviews, the stack view will grow vertically.
Here's a complete example, based on the images you've shown: https://github.com/DonMag/XIBsInScrollView
answered Mar 28 at 17:30
DonMagDonMag
22k3 gold badges14 silver badges36 bronze badges
22k3 gold badges14 silver badges36 bronze badges
Thank you my man, you dont understand how much you have helped. Took me two days playing with it, no joke. Thanks again appreciate it.
– pete800
Mar 28 at 22:49
add a comment
|
Thank you my man, you dont understand how much you have helped. Took me two days playing with it, no joke. Thanks again appreciate it.
– pete800
Mar 28 at 22:49
Thank you my man, you dont understand how much you have helped. Took me two days playing with it, no joke. Thanks again appreciate it.
– pete800
Mar 28 at 22:49
Thank you my man, you dont understand how much you have helped. Took me two days playing with it, no joke. Thanks again appreciate it.
– pete800
Mar 28 at 22:49
add a comment
|
You have to modify the contentSize property of your scrollView in the code. I don’t know how to deal with it with storyboards, but you can make an outlet of your scrollView and calculate the new height each times it changes (each time you add something or remove something in it)
scrollView.contentSize = CGSize(width:yourNewW, height:yourNewH)
Better to use auto-layout and constraints.
– DonMag
Mar 28 at 17:35
Honestly I gave up mixing scrollView with autolayout, it’s been a nightmare of bugs every-time when I tried. From my point of view it’s much more precise and effective to compute old plain coordinates when working with content of a scrollview
– Jerem Lachkar
Mar 28 at 17:37
add a comment
|
You have to modify the contentSize property of your scrollView in the code. I don’t know how to deal with it with storyboards, but you can make an outlet of your scrollView and calculate the new height each times it changes (each time you add something or remove something in it)
scrollView.contentSize = CGSize(width:yourNewW, height:yourNewH)
Better to use auto-layout and constraints.
– DonMag
Mar 28 at 17:35
Honestly I gave up mixing scrollView with autolayout, it’s been a nightmare of bugs every-time when I tried. From my point of view it’s much more precise and effective to compute old plain coordinates when working with content of a scrollview
– Jerem Lachkar
Mar 28 at 17:37
add a comment
|
You have to modify the contentSize property of your scrollView in the code. I don’t know how to deal with it with storyboards, but you can make an outlet of your scrollView and calculate the new height each times it changes (each time you add something or remove something in it)
scrollView.contentSize = CGSize(width:yourNewW, height:yourNewH)
You have to modify the contentSize property of your scrollView in the code. I don’t know how to deal with it with storyboards, but you can make an outlet of your scrollView and calculate the new height each times it changes (each time you add something or remove something in it)
scrollView.contentSize = CGSize(width:yourNewW, height:yourNewH)
answered Mar 28 at 17:34
Jerem LachkarJerem Lachkar
741 silver badge8 bronze badges
741 silver badge8 bronze badges
Better to use auto-layout and constraints.
– DonMag
Mar 28 at 17:35
Honestly I gave up mixing scrollView with autolayout, it’s been a nightmare of bugs every-time when I tried. From my point of view it’s much more precise and effective to compute old plain coordinates when working with content of a scrollview
– Jerem Lachkar
Mar 28 at 17:37
add a comment
|
Better to use auto-layout and constraints.
– DonMag
Mar 28 at 17:35
Honestly I gave up mixing scrollView with autolayout, it’s been a nightmare of bugs every-time when I tried. From my point of view it’s much more precise and effective to compute old plain coordinates when working with content of a scrollview
– Jerem Lachkar
Mar 28 at 17:37
Better to use auto-layout and constraints.
– DonMag
Mar 28 at 17:35
Better to use auto-layout and constraints.
– DonMag
Mar 28 at 17:35
Honestly I gave up mixing scrollView with autolayout, it’s been a nightmare of bugs every-time when I tried. From my point of view it’s much more precise and effective to compute old plain coordinates when working with content of a scrollview
– Jerem Lachkar
Mar 28 at 17:37
Honestly I gave up mixing scrollView with autolayout, it’s been a nightmare of bugs every-time when I tried. From my point of view it’s much more precise and effective to compute old plain coordinates when working with content of a scrollview
– Jerem Lachkar
Mar 28 at 17:37
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.
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%2f55399808%2fscrollview-with-embedded-stackview-issue%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
Show how are you loading the xib content.
– DonMag
Mar 28 at 15:23
@DonMag just updated it there to show how xibs are called.
– pete800
Mar 28 at 15:30