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;








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.



enter image description here



enter image description hereAn example of how far down i can scroll (note the xib view is cut off as it only shows a certain amount of green.) enter image description here



enter image description here



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











share|improve this question


























  • 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

















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.



enter image description here



enter image description hereAn example of how far down i can scroll (note the xib view is cut off as it only shows a certain amount of green.) enter image description here



enter image description here



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











share|improve this question


























  • 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













0












0








0


1






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.



enter image description here



enter image description hereAn example of how far down i can scroll (note the xib view is cut off as it only shows a certain amount of green.) enter image description here



enter image description here



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











share|improve this question
















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.



enter image description here



enter image description hereAn example of how far down i can scroll (note the xib view is cut off as it only shows a certain amount of green.) enter image description here



enter image description here



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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












2 Answers
2






active

oldest

votes


















1
















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






share|improve this answer

























  • 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


















0
















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)





share|improve this answer

























  • 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













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
);



);














draft saved

draft discarded
















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









1
















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






share|improve this answer

























  • 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















1
















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






share|improve this answer

























  • 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













1














1










1









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






share|improve this answer













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







share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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













0
















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)





share|improve this answer

























  • 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















0
















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)





share|improve this answer

























  • 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













0














0










0









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)





share|improve this answer













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)






share|improve this answer












share|improve this answer



share|improve this answer










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

















  • 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


















draft saved

draft discarded















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해