How to increase tableViewCell height when increasing UiImageView height within the cell?









up vote
1
down vote

favorite












I am banging my head around this issue for quite a time. I have aUITableViewCell that contains 2 UIImageView's. look like this:



enter image description here



Now the way it works is that when I slide with my finger on one of the pictures, that picture should expand it's width to the other side of the screen and it's height should enlarge to the size of the expanded width to make it even (I am using UIPanGestureRecognizer), which requires the UITableViewCell to enlarge too.



But for some reason I have not managed to accomplish this presumably simple task. and although the UiImageView's are enlarging as I want, but the UITableViewCell height - remains static. which results in the bottom of the cell getting hidden



Based on suggestions to similar questions asked in stack overflow, I have tried the following, yet I still cannot resolve the issue.



I have added the following snippet of code in my viewDidLoad:



tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 470


but not only this did not solve the problem, Now with the automatic height most of the cell is hidden and only the top is shown. seems like for some reason it requires a static row height but then again How do I cause the cell height to enlarge in response to UIImageView enlargement within the cell.










share|improve this question























  • When using UITableViewAutomaticDimension you should be careful to add all the vertical constraints for all the elements. Because that's how table view will calculate cell height by using constraint constants.Can you share how did you expand your image height?
    – DionizB
    yesterday










  • the 2 images are inside of a UIView container and the view container has a constraint height and every time I pan, I'm increasing the NSLayoutConstraint outlet constant self.picsContainerHeight.constant = self.picsContainer.frame.width
    – Hudi Ilfeld
    yesterday










  • Did you try reloading current table cell while detecting UIPanGestureRecognizer, or beginning tableView updates after Pan Gesture is detected?
    – DionizB
    yesterday










  • yes. it doesn't help
    – Hudi Ilfeld
    yesterday










  • are you reloading this row after pan gesture is applied to the cell ?? , if not try to reload the row.
    – MhmdRizk
    yesterday














up vote
1
down vote

favorite












I am banging my head around this issue for quite a time. I have aUITableViewCell that contains 2 UIImageView's. look like this:



enter image description here



Now the way it works is that when I slide with my finger on one of the pictures, that picture should expand it's width to the other side of the screen and it's height should enlarge to the size of the expanded width to make it even (I am using UIPanGestureRecognizer), which requires the UITableViewCell to enlarge too.



But for some reason I have not managed to accomplish this presumably simple task. and although the UiImageView's are enlarging as I want, but the UITableViewCell height - remains static. which results in the bottom of the cell getting hidden



Based on suggestions to similar questions asked in stack overflow, I have tried the following, yet I still cannot resolve the issue.



I have added the following snippet of code in my viewDidLoad:



tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 470


but not only this did not solve the problem, Now with the automatic height most of the cell is hidden and only the top is shown. seems like for some reason it requires a static row height but then again How do I cause the cell height to enlarge in response to UIImageView enlargement within the cell.










share|improve this question























  • When using UITableViewAutomaticDimension you should be careful to add all the vertical constraints for all the elements. Because that's how table view will calculate cell height by using constraint constants.Can you share how did you expand your image height?
    – DionizB
    yesterday










  • the 2 images are inside of a UIView container and the view container has a constraint height and every time I pan, I'm increasing the NSLayoutConstraint outlet constant self.picsContainerHeight.constant = self.picsContainer.frame.width
    – Hudi Ilfeld
    yesterday










  • Did you try reloading current table cell while detecting UIPanGestureRecognizer, or beginning tableView updates after Pan Gesture is detected?
    – DionizB
    yesterday










  • yes. it doesn't help
    – Hudi Ilfeld
    yesterday










  • are you reloading this row after pan gesture is applied to the cell ?? , if not try to reload the row.
    – MhmdRizk
    yesterday












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am banging my head around this issue for quite a time. I have aUITableViewCell that contains 2 UIImageView's. look like this:



enter image description here



Now the way it works is that when I slide with my finger on one of the pictures, that picture should expand it's width to the other side of the screen and it's height should enlarge to the size of the expanded width to make it even (I am using UIPanGestureRecognizer), which requires the UITableViewCell to enlarge too.



But for some reason I have not managed to accomplish this presumably simple task. and although the UiImageView's are enlarging as I want, but the UITableViewCell height - remains static. which results in the bottom of the cell getting hidden



Based on suggestions to similar questions asked in stack overflow, I have tried the following, yet I still cannot resolve the issue.



I have added the following snippet of code in my viewDidLoad:



tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 470


but not only this did not solve the problem, Now with the automatic height most of the cell is hidden and only the top is shown. seems like for some reason it requires a static row height but then again How do I cause the cell height to enlarge in response to UIImageView enlargement within the cell.










share|improve this question















I am banging my head around this issue for quite a time. I have aUITableViewCell that contains 2 UIImageView's. look like this:



enter image description here



Now the way it works is that when I slide with my finger on one of the pictures, that picture should expand it's width to the other side of the screen and it's height should enlarge to the size of the expanded width to make it even (I am using UIPanGestureRecognizer), which requires the UITableViewCell to enlarge too.



But for some reason I have not managed to accomplish this presumably simple task. and although the UiImageView's are enlarging as I want, but the UITableViewCell height - remains static. which results in the bottom of the cell getting hidden



Based on suggestions to similar questions asked in stack overflow, I have tried the following, yet I still cannot resolve the issue.



I have added the following snippet of code in my viewDidLoad:



tableView.rowHeight = UITableViewAutomaticDimension
tableView.estimatedRowHeight = 470


but not only this did not solve the problem, Now with the automatic height most of the cell is hidden and only the top is shown. seems like for some reason it requires a static row height but then again How do I cause the cell height to enlarge in response to UIImageView enlargement within the cell.







ios swift uitableview






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday









RoHaN

300314




300314










asked yesterday









Hudi Ilfeld

1861114




1861114











  • When using UITableViewAutomaticDimension you should be careful to add all the vertical constraints for all the elements. Because that's how table view will calculate cell height by using constraint constants.Can you share how did you expand your image height?
    – DionizB
    yesterday










  • the 2 images are inside of a UIView container and the view container has a constraint height and every time I pan, I'm increasing the NSLayoutConstraint outlet constant self.picsContainerHeight.constant = self.picsContainer.frame.width
    – Hudi Ilfeld
    yesterday










  • Did you try reloading current table cell while detecting UIPanGestureRecognizer, or beginning tableView updates after Pan Gesture is detected?
    – DionizB
    yesterday










  • yes. it doesn't help
    – Hudi Ilfeld
    yesterday










  • are you reloading this row after pan gesture is applied to the cell ?? , if not try to reload the row.
    – MhmdRizk
    yesterday
















  • When using UITableViewAutomaticDimension you should be careful to add all the vertical constraints for all the elements. Because that's how table view will calculate cell height by using constraint constants.Can you share how did you expand your image height?
    – DionizB
    yesterday










  • the 2 images are inside of a UIView container and the view container has a constraint height and every time I pan, I'm increasing the NSLayoutConstraint outlet constant self.picsContainerHeight.constant = self.picsContainer.frame.width
    – Hudi Ilfeld
    yesterday










  • Did you try reloading current table cell while detecting UIPanGestureRecognizer, or beginning tableView updates after Pan Gesture is detected?
    – DionizB
    yesterday










  • yes. it doesn't help
    – Hudi Ilfeld
    yesterday










  • are you reloading this row after pan gesture is applied to the cell ?? , if not try to reload the row.
    – MhmdRizk
    yesterday















When using UITableViewAutomaticDimension you should be careful to add all the vertical constraints for all the elements. Because that's how table view will calculate cell height by using constraint constants.Can you share how did you expand your image height?
– DionizB
yesterday




When using UITableViewAutomaticDimension you should be careful to add all the vertical constraints for all the elements. Because that's how table view will calculate cell height by using constraint constants.Can you share how did you expand your image height?
– DionizB
yesterday












the 2 images are inside of a UIView container and the view container has a constraint height and every time I pan, I'm increasing the NSLayoutConstraint outlet constant self.picsContainerHeight.constant = self.picsContainer.frame.width
– Hudi Ilfeld
yesterday




the 2 images are inside of a UIView container and the view container has a constraint height and every time I pan, I'm increasing the NSLayoutConstraint outlet constant self.picsContainerHeight.constant = self.picsContainer.frame.width
– Hudi Ilfeld
yesterday












Did you try reloading current table cell while detecting UIPanGestureRecognizer, or beginning tableView updates after Pan Gesture is detected?
– DionizB
yesterday




Did you try reloading current table cell while detecting UIPanGestureRecognizer, or beginning tableView updates after Pan Gesture is detected?
– DionizB
yesterday












yes. it doesn't help
– Hudi Ilfeld
yesterday




yes. it doesn't help
– Hudi Ilfeld
yesterday












are you reloading this row after pan gesture is applied to the cell ?? , if not try to reload the row.
– MhmdRizk
yesterday




are you reloading this row after pan gesture is applied to the cell ?? , if not try to reload the row.
– MhmdRizk
yesterday












1 Answer
1






active

oldest

votes

















up vote
0
down vote













You should call tableView.beginUpdates(); tableView.endUpdates() at the end of animation and make sure that the cell is constrained to every edge (self-sizing cell).



This is documented in beginUpdates method




... You can also use this method followed by the endUpdates() method
to animate the change in the row heights without reloading the cell.
...







share|improve this answer




















  • my UIViews are constrained to the the Content View, but I the interface builder doesn't allow me to constrain my Cell or my Content View
    – Hudi Ilfeld
    yesterday










  • That is OK. The important thing is that every vertical constraint is setted so the cell can calculate the height itself. Search for self-sizing cells on iOS. There is plenty of information.
    – hfehrmann
    yesterday










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



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224420%2fhow-to-increase-tableviewcell-height-when-increasing-uiimageview-height-within-t%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













You should call tableView.beginUpdates(); tableView.endUpdates() at the end of animation and make sure that the cell is constrained to every edge (self-sizing cell).



This is documented in beginUpdates method




... You can also use this method followed by the endUpdates() method
to animate the change in the row heights without reloading the cell.
...







share|improve this answer




















  • my UIViews are constrained to the the Content View, but I the interface builder doesn't allow me to constrain my Cell or my Content View
    – Hudi Ilfeld
    yesterday










  • That is OK. The important thing is that every vertical constraint is setted so the cell can calculate the height itself. Search for self-sizing cells on iOS. There is plenty of information.
    – hfehrmann
    yesterday














up vote
0
down vote













You should call tableView.beginUpdates(); tableView.endUpdates() at the end of animation and make sure that the cell is constrained to every edge (self-sizing cell).



This is documented in beginUpdates method




... You can also use this method followed by the endUpdates() method
to animate the change in the row heights without reloading the cell.
...







share|improve this answer




















  • my UIViews are constrained to the the Content View, but I the interface builder doesn't allow me to constrain my Cell or my Content View
    – Hudi Ilfeld
    yesterday










  • That is OK. The important thing is that every vertical constraint is setted so the cell can calculate the height itself. Search for self-sizing cells on iOS. There is plenty of information.
    – hfehrmann
    yesterday












up vote
0
down vote










up vote
0
down vote









You should call tableView.beginUpdates(); tableView.endUpdates() at the end of animation and make sure that the cell is constrained to every edge (self-sizing cell).



This is documented in beginUpdates method




... You can also use this method followed by the endUpdates() method
to animate the change in the row heights without reloading the cell.
...







share|improve this answer












You should call tableView.beginUpdates(); tableView.endUpdates() at the end of animation and make sure that the cell is constrained to every edge (self-sizing cell).



This is documented in beginUpdates method




... You can also use this method followed by the endUpdates() method
to animate the change in the row heights without reloading the cell.
...








share|improve this answer












share|improve this answer



share|improve this answer










answered yesterday









hfehrmann

13212




13212











  • my UIViews are constrained to the the Content View, but I the interface builder doesn't allow me to constrain my Cell or my Content View
    – Hudi Ilfeld
    yesterday










  • That is OK. The important thing is that every vertical constraint is setted so the cell can calculate the height itself. Search for self-sizing cells on iOS. There is plenty of information.
    – hfehrmann
    yesterday
















  • my UIViews are constrained to the the Content View, but I the interface builder doesn't allow me to constrain my Cell or my Content View
    – Hudi Ilfeld
    yesterday










  • That is OK. The important thing is that every vertical constraint is setted so the cell can calculate the height itself. Search for self-sizing cells on iOS. There is plenty of information.
    – hfehrmann
    yesterday















my UIViews are constrained to the the Content View, but I the interface builder doesn't allow me to constrain my Cell or my Content View
– Hudi Ilfeld
yesterday




my UIViews are constrained to the the Content View, but I the interface builder doesn't allow me to constrain my Cell or my Content View
– Hudi Ilfeld
yesterday












That is OK. The important thing is that every vertical constraint is setted so the cell can calculate the height itself. Search for self-sizing cells on iOS. There is plenty of information.
– hfehrmann
yesterday




That is OK. The important thing is that every vertical constraint is setted so the cell can calculate the height itself. Search for self-sizing cells on iOS. There is plenty of information.
– hfehrmann
yesterday

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53224420%2fhow-to-increase-tableviewcell-height-when-increasing-uiimageview-height-within-t%23new-answer', 'question_page');

);

Post as a guest














































































Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo