UIView containing UITableView extends outside bounds of Parent UIView and does not scroll
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have a custom UIView and .xib called ViewA, ViewA has a fixed height of 60pts. ViewA has a subview named ViewB (which has its own .xib) which contains a UITableView. ViewB is initially hidden and has a height of 400pts (much bigger than the height of ViewA). ViewA also has button which shows and hides ViewB. ViewBs X and Y coordinates are 0,0 to that of ViewA, ViewB also has the same width as ViewA. When pressing ViewAs button to reveal ViewB it is shown correctly - ViewB extends outside of ViewAs bounds. However, I can only scroll ViewBs UITableView within the first 60pts (the bounds of ViewA) the rest of the extended view does not scroll.
I have tried using hitTest answers found here but I cannot seem to get it to work.
- https://stackoverflow.com/a/29869695/2654425
The desired effect is that ViewA will display ViewB which should have its full interaction and act as normal. ViewB should also overlap any other views that may be in a UIViewController. It works fine apart from the UITableView in ViewB not being fully scrollable ie. scrolling from the row at index 0 scrolls the table fine, but there is no scrolling from `index 5`` for example.
Any help would be greatly appreciated?
Some more info:
- Autolayout is being used in the storyboard
ViewBszPositionis 1- the desired effect is similar to date of a DropDown menu.
- I dont want to use a third party library
Thanks in advance.
ios swift uitableview uiview
add a comment |
I have a custom UIView and .xib called ViewA, ViewA has a fixed height of 60pts. ViewA has a subview named ViewB (which has its own .xib) which contains a UITableView. ViewB is initially hidden and has a height of 400pts (much bigger than the height of ViewA). ViewA also has button which shows and hides ViewB. ViewBs X and Y coordinates are 0,0 to that of ViewA, ViewB also has the same width as ViewA. When pressing ViewAs button to reveal ViewB it is shown correctly - ViewB extends outside of ViewAs bounds. However, I can only scroll ViewBs UITableView within the first 60pts (the bounds of ViewA) the rest of the extended view does not scroll.
I have tried using hitTest answers found here but I cannot seem to get it to work.
- https://stackoverflow.com/a/29869695/2654425
The desired effect is that ViewA will display ViewB which should have its full interaction and act as normal. ViewB should also overlap any other views that may be in a UIViewController. It works fine apart from the UITableView in ViewB not being fully scrollable ie. scrolling from the row at index 0 scrolls the table fine, but there is no scrolling from `index 5`` for example.
Any help would be greatly appreciated?
Some more info:
- Autolayout is being used in the storyboard
ViewBszPositionis 1- the desired effect is similar to date of a DropDown menu.
- I dont want to use a third party library
Thanks in advance.
ios swift uitableview uiview
Set .clipsToBounds = true` on ViewA and you'll see why you can't scroll. You need to change the height of ViewA to match the height of ViewB.
– DonMag
Nov 16 '18 at 18:28
@DonMag ya I did that thanks. I tried adjusting the height also, when ViewB is being presented I set ViewA to have the same height as it. ViewB was still unscrollabe. But when I dismissed ViewB, ViewA was the new height that I set. However I did notice that the button I was using to reveal ViewB was only clickable within its original height also, not the new one 🤔
– DevC
Nov 16 '18 at 19:07
Hmmm... still sounds like a bounds issue. Is ViewA also contained in another, shorter view?
– DonMag
Nov 16 '18 at 19:33
@DonMag ViewA is just in a ViewController. It’s possible that’s something else is going on with my .xib maybe
– DevC
Nov 16 '18 at 19:35
To debug... set all related views toClip to Bounds, and give each one a different background color. That often makes it much easier to see what's going on at run-time. Also, use Debug View Hierarchy to check the views.
– DonMag
Nov 16 '18 at 20:12
add a comment |
I have a custom UIView and .xib called ViewA, ViewA has a fixed height of 60pts. ViewA has a subview named ViewB (which has its own .xib) which contains a UITableView. ViewB is initially hidden and has a height of 400pts (much bigger than the height of ViewA). ViewA also has button which shows and hides ViewB. ViewBs X and Y coordinates are 0,0 to that of ViewA, ViewB also has the same width as ViewA. When pressing ViewAs button to reveal ViewB it is shown correctly - ViewB extends outside of ViewAs bounds. However, I can only scroll ViewBs UITableView within the first 60pts (the bounds of ViewA) the rest of the extended view does not scroll.
I have tried using hitTest answers found here but I cannot seem to get it to work.
- https://stackoverflow.com/a/29869695/2654425
The desired effect is that ViewA will display ViewB which should have its full interaction and act as normal. ViewB should also overlap any other views that may be in a UIViewController. It works fine apart from the UITableView in ViewB not being fully scrollable ie. scrolling from the row at index 0 scrolls the table fine, but there is no scrolling from `index 5`` for example.
Any help would be greatly appreciated?
Some more info:
- Autolayout is being used in the storyboard
ViewBszPositionis 1- the desired effect is similar to date of a DropDown menu.
- I dont want to use a third party library
Thanks in advance.
ios swift uitableview uiview
I have a custom UIView and .xib called ViewA, ViewA has a fixed height of 60pts. ViewA has a subview named ViewB (which has its own .xib) which contains a UITableView. ViewB is initially hidden and has a height of 400pts (much bigger than the height of ViewA). ViewA also has button which shows and hides ViewB. ViewBs X and Y coordinates are 0,0 to that of ViewA, ViewB also has the same width as ViewA. When pressing ViewAs button to reveal ViewB it is shown correctly - ViewB extends outside of ViewAs bounds. However, I can only scroll ViewBs UITableView within the first 60pts (the bounds of ViewA) the rest of the extended view does not scroll.
I have tried using hitTest answers found here but I cannot seem to get it to work.
- https://stackoverflow.com/a/29869695/2654425
The desired effect is that ViewA will display ViewB which should have its full interaction and act as normal. ViewB should also overlap any other views that may be in a UIViewController. It works fine apart from the UITableView in ViewB not being fully scrollable ie. scrolling from the row at index 0 scrolls the table fine, but there is no scrolling from `index 5`` for example.
Any help would be greatly appreciated?
Some more info:
- Autolayout is being used in the storyboard
ViewBszPositionis 1- the desired effect is similar to date of a DropDown menu.
- I dont want to use a third party library
Thanks in advance.
ios swift uitableview uiview
ios swift uitableview uiview
asked Nov 16 '18 at 18:24
DevCDevC
3,54663776
3,54663776
Set .clipsToBounds = true` on ViewA and you'll see why you can't scroll. You need to change the height of ViewA to match the height of ViewB.
– DonMag
Nov 16 '18 at 18:28
@DonMag ya I did that thanks. I tried adjusting the height also, when ViewB is being presented I set ViewA to have the same height as it. ViewB was still unscrollabe. But when I dismissed ViewB, ViewA was the new height that I set. However I did notice that the button I was using to reveal ViewB was only clickable within its original height also, not the new one 🤔
– DevC
Nov 16 '18 at 19:07
Hmmm... still sounds like a bounds issue. Is ViewA also contained in another, shorter view?
– DonMag
Nov 16 '18 at 19:33
@DonMag ViewA is just in a ViewController. It’s possible that’s something else is going on with my .xib maybe
– DevC
Nov 16 '18 at 19:35
To debug... set all related views toClip to Bounds, and give each one a different background color. That often makes it much easier to see what's going on at run-time. Also, use Debug View Hierarchy to check the views.
– DonMag
Nov 16 '18 at 20:12
add a comment |
Set .clipsToBounds = true` on ViewA and you'll see why you can't scroll. You need to change the height of ViewA to match the height of ViewB.
– DonMag
Nov 16 '18 at 18:28
@DonMag ya I did that thanks. I tried adjusting the height also, when ViewB is being presented I set ViewA to have the same height as it. ViewB was still unscrollabe. But when I dismissed ViewB, ViewA was the new height that I set. However I did notice that the button I was using to reveal ViewB was only clickable within its original height also, not the new one 🤔
– DevC
Nov 16 '18 at 19:07
Hmmm... still sounds like a bounds issue. Is ViewA also contained in another, shorter view?
– DonMag
Nov 16 '18 at 19:33
@DonMag ViewA is just in a ViewController. It’s possible that’s something else is going on with my .xib maybe
– DevC
Nov 16 '18 at 19:35
To debug... set all related views toClip to Bounds, and give each one a different background color. That often makes it much easier to see what's going on at run-time. Also, use Debug View Hierarchy to check the views.
– DonMag
Nov 16 '18 at 20:12
Set .clipsToBounds = true` on ViewA and you'll see why you can't scroll. You need to change the height of ViewA to match the height of ViewB.
– DonMag
Nov 16 '18 at 18:28
Set .clipsToBounds = true` on ViewA and you'll see why you can't scroll. You need to change the height of ViewA to match the height of ViewB.
– DonMag
Nov 16 '18 at 18:28
@DonMag ya I did that thanks. I tried adjusting the height also, when ViewB is being presented I set ViewA to have the same height as it. ViewB was still unscrollabe. But when I dismissed ViewB, ViewA was the new height that I set. However I did notice that the button I was using to reveal ViewB was only clickable within its original height also, not the new one 🤔
– DevC
Nov 16 '18 at 19:07
@DonMag ya I did that thanks. I tried adjusting the height also, when ViewB is being presented I set ViewA to have the same height as it. ViewB was still unscrollabe. But when I dismissed ViewB, ViewA was the new height that I set. However I did notice that the button I was using to reveal ViewB was only clickable within its original height also, not the new one 🤔
– DevC
Nov 16 '18 at 19:07
Hmmm... still sounds like a bounds issue. Is ViewA also contained in another, shorter view?
– DonMag
Nov 16 '18 at 19:33
Hmmm... still sounds like a bounds issue. Is ViewA also contained in another, shorter view?
– DonMag
Nov 16 '18 at 19:33
@DonMag ViewA is just in a ViewController. It’s possible that’s something else is going on with my .xib maybe
– DevC
Nov 16 '18 at 19:35
@DonMag ViewA is just in a ViewController. It’s possible that’s something else is going on with my .xib maybe
– DevC
Nov 16 '18 at 19:35
To debug... set all related views to
Clip to Bounds, and give each one a different background color. That often makes it much easier to see what's going on at run-time. Also, use Debug View Hierarchy to check the views.– DonMag
Nov 16 '18 at 20:12
To debug... set all related views to
Clip to Bounds, and give each one a different background color. That often makes it much easier to see what's going on at run-time. Also, use Debug View Hierarchy to check the views.– DonMag
Nov 16 '18 at 20:12
add a comment |
0
active
oldest
votes
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/3.0/"u003ecc by-sa 3.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%2f53343427%2fuiview-containing-uitableview-extends-outside-bounds-of-parent-uiview-and-does-n%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f53343427%2fuiview-containing-uitableview-extends-outside-bounds-of-parent-uiview-and-does-n%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
Set .clipsToBounds = true` on ViewA and you'll see why you can't scroll. You need to change the height of ViewA to match the height of ViewB.
– DonMag
Nov 16 '18 at 18:28
@DonMag ya I did that thanks. I tried adjusting the height also, when ViewB is being presented I set ViewA to have the same height as it. ViewB was still unscrollabe. But when I dismissed ViewB, ViewA was the new height that I set. However I did notice that the button I was using to reveal ViewB was only clickable within its original height also, not the new one 🤔
– DevC
Nov 16 '18 at 19:07
Hmmm... still sounds like a bounds issue. Is ViewA also contained in another, shorter view?
– DonMag
Nov 16 '18 at 19:33
@DonMag ViewA is just in a ViewController. It’s possible that’s something else is going on with my .xib maybe
– DevC
Nov 16 '18 at 19:35
To debug... set all related views to
Clip to Bounds, and give each one a different background color. That often makes it much easier to see what's going on at run-time. Also, use Debug View Hierarchy to check the views.– DonMag
Nov 16 '18 at 20:12