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:
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
|
show 2 more comments
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:
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
When usingUITableViewAutomaticDimension
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 constantself.picsContainerHeight.constant = self.picsContainer.frame.width
– Hudi Ilfeld
yesterday
Did you try reloading current table cell while detectingUIPanGestureRecognizer
, 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
|
show 2 more comments
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:
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
I am banging my head around this issue for quite a time. I have aUITableViewCell
that contains 2 UIImageView's
. look like this:
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
ios swift uitableview
edited yesterday
RoHaN
300314
300314
asked yesterday
Hudi Ilfeld
1861114
1861114
When usingUITableViewAutomaticDimension
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 constantself.picsContainerHeight.constant = self.picsContainer.frame.width
– Hudi Ilfeld
yesterday
Did you try reloading current table cell while detectingUIPanGestureRecognizer
, 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
|
show 2 more comments
When usingUITableViewAutomaticDimension
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 constantself.picsContainerHeight.constant = self.picsContainer.frame.width
– Hudi Ilfeld
yesterday
Did you try reloading current table cell while detectingUIPanGestureRecognizer
, 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
|
show 2 more comments
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.
...
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
add a comment |
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.
...
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
add a comment |
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.
...
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
add a comment |
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.
...
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.
...
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
add a comment |
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
add a comment |
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
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
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
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
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
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