Hide UITableview cell
i'm trying to Hide a cell from a UITableView. just like the delete action do but i just want to hide it to later show it in the same position.
i know that UITableViewCell has a property called "Hidden" but when i hide the Cell using this property it hide but no animated and they leave a blank space
Example:
- first cell
- second cell
- third cell
it's possible that when i hide the second cell, that third cell change position to 2 ?
thanks
ios objective-c uitableview
add a comment |
i'm trying to Hide a cell from a UITableView. just like the delete action do but i just want to hide it to later show it in the same position.
i know that UITableViewCell has a property called "Hidden" but when i hide the Cell using this property it hide but no animated and they leave a blank space
Example:
- first cell
- second cell
- third cell
it's possible that when i hide the second cell, that third cell change position to 2 ?
thanks
ios objective-c uitableview
1
You can add cell at particular position, same like you delete., have a look stackoverflow.com/questions/19503958/…
– Jageen
Apr 27 '15 at 3:27
1
You need to remove the cell and later insert the cell.
– rmaddy
Apr 27 '15 at 3:27
1
UITableView has insert/delete cell methods with animation option but you must manage your data source by yourself while you use these methods. developer.apple.com/library/ios/documentation/UIKit/Reference/…:
– Suttikeat Witchayakul
Apr 27 '15 at 3:29
I think you are looking for this. stackoverflow.com/a/28020367/3411787
– Zaid Pathan
Apr 27 '15 at 4:57
Thehiddenproperty you mention is actually onUIView, so you can hide any view. This however simply makes it invisible, it doesn't updateUITableView's accounting for the row height.
– Tim Johnsen
Apr 27 '15 at 6:24
add a comment |
i'm trying to Hide a cell from a UITableView. just like the delete action do but i just want to hide it to later show it in the same position.
i know that UITableViewCell has a property called "Hidden" but when i hide the Cell using this property it hide but no animated and they leave a blank space
Example:
- first cell
- second cell
- third cell
it's possible that when i hide the second cell, that third cell change position to 2 ?
thanks
ios objective-c uitableview
i'm trying to Hide a cell from a UITableView. just like the delete action do but i just want to hide it to later show it in the same position.
i know that UITableViewCell has a property called "Hidden" but when i hide the Cell using this property it hide but no animated and they leave a blank space
Example:
- first cell
- second cell
- third cell
it's possible that when i hide the second cell, that third cell change position to 2 ?
thanks
ios objective-c uitableview
ios objective-c uitableview
asked Apr 27 '15 at 3:22
user1628700user1628700
1181211
1181211
1
You can add cell at particular position, same like you delete., have a look stackoverflow.com/questions/19503958/…
– Jageen
Apr 27 '15 at 3:27
1
You need to remove the cell and later insert the cell.
– rmaddy
Apr 27 '15 at 3:27
1
UITableView has insert/delete cell methods with animation option but you must manage your data source by yourself while you use these methods. developer.apple.com/library/ios/documentation/UIKit/Reference/…:
– Suttikeat Witchayakul
Apr 27 '15 at 3:29
I think you are looking for this. stackoverflow.com/a/28020367/3411787
– Zaid Pathan
Apr 27 '15 at 4:57
Thehiddenproperty you mention is actually onUIView, so you can hide any view. This however simply makes it invisible, it doesn't updateUITableView's accounting for the row height.
– Tim Johnsen
Apr 27 '15 at 6:24
add a comment |
1
You can add cell at particular position, same like you delete., have a look stackoverflow.com/questions/19503958/…
– Jageen
Apr 27 '15 at 3:27
1
You need to remove the cell and later insert the cell.
– rmaddy
Apr 27 '15 at 3:27
1
UITableView has insert/delete cell methods with animation option but you must manage your data source by yourself while you use these methods. developer.apple.com/library/ios/documentation/UIKit/Reference/…:
– Suttikeat Witchayakul
Apr 27 '15 at 3:29
I think you are looking for this. stackoverflow.com/a/28020367/3411787
– Zaid Pathan
Apr 27 '15 at 4:57
Thehiddenproperty you mention is actually onUIView, so you can hide any view. This however simply makes it invisible, it doesn't updateUITableView's accounting for the row height.
– Tim Johnsen
Apr 27 '15 at 6:24
1
1
You can add cell at particular position, same like you delete., have a look stackoverflow.com/questions/19503958/…
– Jageen
Apr 27 '15 at 3:27
You can add cell at particular position, same like you delete., have a look stackoverflow.com/questions/19503958/…
– Jageen
Apr 27 '15 at 3:27
1
1
You need to remove the cell and later insert the cell.
– rmaddy
Apr 27 '15 at 3:27
You need to remove the cell and later insert the cell.
– rmaddy
Apr 27 '15 at 3:27
1
1
UITableView has insert/delete cell methods with animation option but you must manage your data source by yourself while you use these methods. developer.apple.com/library/ios/documentation/UIKit/Reference/…:
– Suttikeat Witchayakul
Apr 27 '15 at 3:29
UITableView has insert/delete cell methods with animation option but you must manage your data source by yourself while you use these methods. developer.apple.com/library/ios/documentation/UIKit/Reference/…:
– Suttikeat Witchayakul
Apr 27 '15 at 3:29
I think you are looking for this. stackoverflow.com/a/28020367/3411787
– Zaid Pathan
Apr 27 '15 at 4:57
I think you are looking for this. stackoverflow.com/a/28020367/3411787
– Zaid Pathan
Apr 27 '15 at 4:57
The
hidden property you mention is actually on UIView, so you can hide any view. This however simply makes it invisible, it doesn't update UITableView's accounting for the row height.– Tim Johnsen
Apr 27 '15 at 6:24
The
hidden property you mention is actually on UIView, so you can hide any view. This however simply makes it invisible, it doesn't update UITableView's accounting for the row height.– Tim Johnsen
Apr 27 '15 at 6:24
add a comment |
8 Answers
8
active
oldest
votes
One way to effectively "hide" a row with animation and without actually removing it is to set it's height to zero. You'd do so by overriding -tableView:heightForRowAtIndexPath:.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat height = 0.0;
if (isRowHidden) {
height = 0.0;
} else {
height = 44.0;
}
return height;
}
(You'd only want to return 0.0 for the specific row or rows you want to hide of course, not unconditionally).
Simply changing the return value of this method doesn't make the table view automatically adjust the row's height, to make it do so you make the following calls.
isRowHidden = YES;
[tableView beginUpdates];
[tableView endUpdates];
If you do so you'll see an animated appearance/disappearance transition between the two.
Not sure why this was accepted. This will hide all rows (or none).
– rmaddy
Apr 27 '15 at 17:41
1
Sorry, I meant to imply that you wouldn't do it for all rows in the table view, just the one you meant to show/hide. I should've made that clearer. Will update.
– Tim Johnsen
Apr 27 '15 at 17:43
You only want a zero height for a specific row (or rows). As written, you return a zero height for all or no rows.
– rmaddy
Apr 27 '15 at 17:44
5
You're reading into this very, very literally.
– Tim Johnsen
Apr 27 '15 at 17:55
1
To make the answer more understandable, just change isRowHidden to isRowHidden[indexPath.row]. This way, the row appears/hidden based on the array of boolean defined/setup by coder.
– GeneCode
May 12 '16 at 13:27
|
show 4 more comments
In SWIFT you need to do two things,
HIDE your cell. (because reusable cell may conflict)
Set Height of cell to ZERO.
Look at here,
HIDE you cell.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var myCell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("cellID",forIndexPath: indexPath) as? UITableViewCell
if(indexPath.row == 1){
myCell?.hidden = true
}else{
myCell?.hidden = false
}
return myCell
}
Set Height of cell to ZERO.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
if(indexPath.row == 1){
rowHeight = 0.0
}
else{
rowHeight = 55.0 //or whatever you like
}
}
return rowHeight
}
Using this you can remove reusable cell conflict issues.
You can do the same for cell?.tag also to hide specific cell by tag.
Ref: https://stackoverflow.com/a/28020367/3411787
The question is tagged Objective-C, not Swift. Answers should be in the appropriate language.
– rmaddy
Apr 27 '15 at 17:39
7
Right but as an iOS developer changing code between these two is not a big problem.
– Zaid Pathan
Apr 28 '15 at 4:50
HidingUITableViewCells and setting their height manually is a bad idea because they're managed and recycled by their parentUITableView. If you change the properties of a cell like hiding it it will remain hidden when recycled by itsUITableView.
– Tim Johnsen
Dec 7 '16 at 19:00
@TimJohnsen , please implement what you said, and then try scrolling your tableview, you will know the fact.
– Zaid Pathan
Dec 8 '16 at 5:25
You still shouldn't be hiding table view cells.
– Tim Johnsen
Dec 8 '16 at 18:53
add a comment |
You can't simply hide a UITableViewCell. You have to remove that cell from the table view then insert it again when you would like it to reappear in the table.
The methods you're looking for are deleteRowsAtIndexPaths:withRowAnimation: and insertRowsAtIndexPaths:withRowAnimation:. These are well documented in the UITableView documentation here. You're going to have to remember where you removed the cell from then insert it at the same position later.
Keep in mind that if you add cells to your table with a lesser row index than the row index of the deleted row, you will have to add on to the index to maintain it's relative position.
Hope this helps.
add a comment |
I am using Hidden in Attributes Inspector of TableViewCell -> ContentView and then implement method:
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if shouldHideSection(indexPath.section) {
return 0.0
} else if let isHidden = tableView.cellForRow(at: indexPath)?.contentView.isHidden, isHidden {
return 0.0
}
return super.tableView(tableView, heightForRowAt: indexPath)
}
I like the solution but I seem to be getting an overflow error when calling cellForRow
– bj97301
Aug 8 '18 at 0:44
add a comment |
Same as Zaid Pathan but for Swift 4:
//HIDE you cell.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: NSIndexPath) -> UITableViewCell {
let myCell = tableView.dequeueReusableCell(withIdentifier: "cellID", for: indexPath) as! UITableViewCell
//hide second cell
indexPath.row == 1 ? (cell.isHidden = true): (cell.isHidden = false)
return myCell
}
//Set Height of cell to ZERO.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
indexPath.row == 1 ? (rowHeight = 0.0): (rowHeight = 49.0)
return rowHeight
}
add a comment |
You should delete row and reload table view
[tbv reloadData];
1
Important to note that this will hide or show the row without animation.
– Tim Johnsen
Apr 27 '15 at 6:23
add a comment |
cell display, depending on the data source, so you need to deal with the data source.
if dataArr is the table view datasource,first of all, you should delete the data source where the cell,then
[dataArr removeObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
at last ,you can insert data source when you should add a cell
[dataArr insertObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
add a comment |
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
var rowHeight:CGFloat = 0.0
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
rowHeight = 240.0
}
else
{
rowHeight = 0.0
}
}
return rowHeight
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CompetitionTableViewCell") as! CompetitionTableViewCell
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
cell.isHidden = false
}
else
{
cell.isHidden = true
}
}
cell.selectionStyle = UITableViewCellSelectionStyle.none
return cell
}
While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review
– Nick
Dec 4 '18 at 22:30
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/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%2f29886642%2fhide-uitableview-cell%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
One way to effectively "hide" a row with animation and without actually removing it is to set it's height to zero. You'd do so by overriding -tableView:heightForRowAtIndexPath:.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat height = 0.0;
if (isRowHidden) {
height = 0.0;
} else {
height = 44.0;
}
return height;
}
(You'd only want to return 0.0 for the specific row or rows you want to hide of course, not unconditionally).
Simply changing the return value of this method doesn't make the table view automatically adjust the row's height, to make it do so you make the following calls.
isRowHidden = YES;
[tableView beginUpdates];
[tableView endUpdates];
If you do so you'll see an animated appearance/disappearance transition between the two.
Not sure why this was accepted. This will hide all rows (or none).
– rmaddy
Apr 27 '15 at 17:41
1
Sorry, I meant to imply that you wouldn't do it for all rows in the table view, just the one you meant to show/hide. I should've made that clearer. Will update.
– Tim Johnsen
Apr 27 '15 at 17:43
You only want a zero height for a specific row (or rows). As written, you return a zero height for all or no rows.
– rmaddy
Apr 27 '15 at 17:44
5
You're reading into this very, very literally.
– Tim Johnsen
Apr 27 '15 at 17:55
1
To make the answer more understandable, just change isRowHidden to isRowHidden[indexPath.row]. This way, the row appears/hidden based on the array of boolean defined/setup by coder.
– GeneCode
May 12 '16 at 13:27
|
show 4 more comments
One way to effectively "hide" a row with animation and without actually removing it is to set it's height to zero. You'd do so by overriding -tableView:heightForRowAtIndexPath:.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat height = 0.0;
if (isRowHidden) {
height = 0.0;
} else {
height = 44.0;
}
return height;
}
(You'd only want to return 0.0 for the specific row or rows you want to hide of course, not unconditionally).
Simply changing the return value of this method doesn't make the table view automatically adjust the row's height, to make it do so you make the following calls.
isRowHidden = YES;
[tableView beginUpdates];
[tableView endUpdates];
If you do so you'll see an animated appearance/disappearance transition between the two.
Not sure why this was accepted. This will hide all rows (or none).
– rmaddy
Apr 27 '15 at 17:41
1
Sorry, I meant to imply that you wouldn't do it for all rows in the table view, just the one you meant to show/hide. I should've made that clearer. Will update.
– Tim Johnsen
Apr 27 '15 at 17:43
You only want a zero height for a specific row (or rows). As written, you return a zero height for all or no rows.
– rmaddy
Apr 27 '15 at 17:44
5
You're reading into this very, very literally.
– Tim Johnsen
Apr 27 '15 at 17:55
1
To make the answer more understandable, just change isRowHidden to isRowHidden[indexPath.row]. This way, the row appears/hidden based on the array of boolean defined/setup by coder.
– GeneCode
May 12 '16 at 13:27
|
show 4 more comments
One way to effectively "hide" a row with animation and without actually removing it is to set it's height to zero. You'd do so by overriding -tableView:heightForRowAtIndexPath:.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat height = 0.0;
if (isRowHidden) {
height = 0.0;
} else {
height = 44.0;
}
return height;
}
(You'd only want to return 0.0 for the specific row or rows you want to hide of course, not unconditionally).
Simply changing the return value of this method doesn't make the table view automatically adjust the row's height, to make it do so you make the following calls.
isRowHidden = YES;
[tableView beginUpdates];
[tableView endUpdates];
If you do so you'll see an animated appearance/disappearance transition between the two.
One way to effectively "hide" a row with animation and without actually removing it is to set it's height to zero. You'd do so by overriding -tableView:heightForRowAtIndexPath:.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGFloat height = 0.0;
if (isRowHidden) {
height = 0.0;
} else {
height = 44.0;
}
return height;
}
(You'd only want to return 0.0 for the specific row or rows you want to hide of course, not unconditionally).
Simply changing the return value of this method doesn't make the table view automatically adjust the row's height, to make it do so you make the following calls.
isRowHidden = YES;
[tableView beginUpdates];
[tableView endUpdates];
If you do so you'll see an animated appearance/disappearance transition between the two.
edited Apr 27 '15 at 17:46
answered Apr 27 '15 at 6:22
Tim JohnsenTim Johnsen
1,029727
1,029727
Not sure why this was accepted. This will hide all rows (or none).
– rmaddy
Apr 27 '15 at 17:41
1
Sorry, I meant to imply that you wouldn't do it for all rows in the table view, just the one you meant to show/hide. I should've made that clearer. Will update.
– Tim Johnsen
Apr 27 '15 at 17:43
You only want a zero height for a specific row (or rows). As written, you return a zero height for all or no rows.
– rmaddy
Apr 27 '15 at 17:44
5
You're reading into this very, very literally.
– Tim Johnsen
Apr 27 '15 at 17:55
1
To make the answer more understandable, just change isRowHidden to isRowHidden[indexPath.row]. This way, the row appears/hidden based on the array of boolean defined/setup by coder.
– GeneCode
May 12 '16 at 13:27
|
show 4 more comments
Not sure why this was accepted. This will hide all rows (or none).
– rmaddy
Apr 27 '15 at 17:41
1
Sorry, I meant to imply that you wouldn't do it for all rows in the table view, just the one you meant to show/hide. I should've made that clearer. Will update.
– Tim Johnsen
Apr 27 '15 at 17:43
You only want a zero height for a specific row (or rows). As written, you return a zero height for all or no rows.
– rmaddy
Apr 27 '15 at 17:44
5
You're reading into this very, very literally.
– Tim Johnsen
Apr 27 '15 at 17:55
1
To make the answer more understandable, just change isRowHidden to isRowHidden[indexPath.row]. This way, the row appears/hidden based on the array of boolean defined/setup by coder.
– GeneCode
May 12 '16 at 13:27
Not sure why this was accepted. This will hide all rows (or none).
– rmaddy
Apr 27 '15 at 17:41
Not sure why this was accepted. This will hide all rows (or none).
– rmaddy
Apr 27 '15 at 17:41
1
1
Sorry, I meant to imply that you wouldn't do it for all rows in the table view, just the one you meant to show/hide. I should've made that clearer. Will update.
– Tim Johnsen
Apr 27 '15 at 17:43
Sorry, I meant to imply that you wouldn't do it for all rows in the table view, just the one you meant to show/hide. I should've made that clearer. Will update.
– Tim Johnsen
Apr 27 '15 at 17:43
You only want a zero height for a specific row (or rows). As written, you return a zero height for all or no rows.
– rmaddy
Apr 27 '15 at 17:44
You only want a zero height for a specific row (or rows). As written, you return a zero height for all or no rows.
– rmaddy
Apr 27 '15 at 17:44
5
5
You're reading into this very, very literally.
– Tim Johnsen
Apr 27 '15 at 17:55
You're reading into this very, very literally.
– Tim Johnsen
Apr 27 '15 at 17:55
1
1
To make the answer more understandable, just change isRowHidden to isRowHidden[indexPath.row]. This way, the row appears/hidden based on the array of boolean defined/setup by coder.
– GeneCode
May 12 '16 at 13:27
To make the answer more understandable, just change isRowHidden to isRowHidden[indexPath.row]. This way, the row appears/hidden based on the array of boolean defined/setup by coder.
– GeneCode
May 12 '16 at 13:27
|
show 4 more comments
In SWIFT you need to do two things,
HIDE your cell. (because reusable cell may conflict)
Set Height of cell to ZERO.
Look at here,
HIDE you cell.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var myCell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("cellID",forIndexPath: indexPath) as? UITableViewCell
if(indexPath.row == 1){
myCell?.hidden = true
}else{
myCell?.hidden = false
}
return myCell
}
Set Height of cell to ZERO.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
if(indexPath.row == 1){
rowHeight = 0.0
}
else{
rowHeight = 55.0 //or whatever you like
}
}
return rowHeight
}
Using this you can remove reusable cell conflict issues.
You can do the same for cell?.tag also to hide specific cell by tag.
Ref: https://stackoverflow.com/a/28020367/3411787
The question is tagged Objective-C, not Swift. Answers should be in the appropriate language.
– rmaddy
Apr 27 '15 at 17:39
7
Right but as an iOS developer changing code between these two is not a big problem.
– Zaid Pathan
Apr 28 '15 at 4:50
HidingUITableViewCells and setting their height manually is a bad idea because they're managed and recycled by their parentUITableView. If you change the properties of a cell like hiding it it will remain hidden when recycled by itsUITableView.
– Tim Johnsen
Dec 7 '16 at 19:00
@TimJohnsen , please implement what you said, and then try scrolling your tableview, you will know the fact.
– Zaid Pathan
Dec 8 '16 at 5:25
You still shouldn't be hiding table view cells.
– Tim Johnsen
Dec 8 '16 at 18:53
add a comment |
In SWIFT you need to do two things,
HIDE your cell. (because reusable cell may conflict)
Set Height of cell to ZERO.
Look at here,
HIDE you cell.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var myCell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("cellID",forIndexPath: indexPath) as? UITableViewCell
if(indexPath.row == 1){
myCell?.hidden = true
}else{
myCell?.hidden = false
}
return myCell
}
Set Height of cell to ZERO.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
if(indexPath.row == 1){
rowHeight = 0.0
}
else{
rowHeight = 55.0 //or whatever you like
}
}
return rowHeight
}
Using this you can remove reusable cell conflict issues.
You can do the same for cell?.tag also to hide specific cell by tag.
Ref: https://stackoverflow.com/a/28020367/3411787
The question is tagged Objective-C, not Swift. Answers should be in the appropriate language.
– rmaddy
Apr 27 '15 at 17:39
7
Right but as an iOS developer changing code between these two is not a big problem.
– Zaid Pathan
Apr 28 '15 at 4:50
HidingUITableViewCells and setting their height manually is a bad idea because they're managed and recycled by their parentUITableView. If you change the properties of a cell like hiding it it will remain hidden when recycled by itsUITableView.
– Tim Johnsen
Dec 7 '16 at 19:00
@TimJohnsen , please implement what you said, and then try scrolling your tableview, you will know the fact.
– Zaid Pathan
Dec 8 '16 at 5:25
You still shouldn't be hiding table view cells.
– Tim Johnsen
Dec 8 '16 at 18:53
add a comment |
In SWIFT you need to do two things,
HIDE your cell. (because reusable cell may conflict)
Set Height of cell to ZERO.
Look at here,
HIDE you cell.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var myCell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("cellID",forIndexPath: indexPath) as? UITableViewCell
if(indexPath.row == 1){
myCell?.hidden = true
}else{
myCell?.hidden = false
}
return myCell
}
Set Height of cell to ZERO.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
if(indexPath.row == 1){
rowHeight = 0.0
}
else{
rowHeight = 55.0 //or whatever you like
}
}
return rowHeight
}
Using this you can remove reusable cell conflict issues.
You can do the same for cell?.tag also to hide specific cell by tag.
Ref: https://stackoverflow.com/a/28020367/3411787
In SWIFT you need to do two things,
HIDE your cell. (because reusable cell may conflict)
Set Height of cell to ZERO.
Look at here,
HIDE you cell.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var myCell:UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("cellID",forIndexPath: indexPath) as? UITableViewCell
if(indexPath.row == 1){
myCell?.hidden = true
}else{
myCell?.hidden = false
}
return myCell
}
Set Height of cell to ZERO.
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
if(indexPath.row == 1){
rowHeight = 0.0
}
else{
rowHeight = 55.0 //or whatever you like
}
}
return rowHeight
}
Using this you can remove reusable cell conflict issues.
You can do the same for cell?.tag also to hide specific cell by tag.
Ref: https://stackoverflow.com/a/28020367/3411787
edited May 23 '17 at 12:32
Community♦
11
11
answered Apr 27 '15 at 5:26
Zaid PathanZaid Pathan
10.6k46785
10.6k46785
The question is tagged Objective-C, not Swift. Answers should be in the appropriate language.
– rmaddy
Apr 27 '15 at 17:39
7
Right but as an iOS developer changing code between these two is not a big problem.
– Zaid Pathan
Apr 28 '15 at 4:50
HidingUITableViewCells and setting their height manually is a bad idea because they're managed and recycled by their parentUITableView. If you change the properties of a cell like hiding it it will remain hidden when recycled by itsUITableView.
– Tim Johnsen
Dec 7 '16 at 19:00
@TimJohnsen , please implement what you said, and then try scrolling your tableview, you will know the fact.
– Zaid Pathan
Dec 8 '16 at 5:25
You still shouldn't be hiding table view cells.
– Tim Johnsen
Dec 8 '16 at 18:53
add a comment |
The question is tagged Objective-C, not Swift. Answers should be in the appropriate language.
– rmaddy
Apr 27 '15 at 17:39
7
Right but as an iOS developer changing code between these two is not a big problem.
– Zaid Pathan
Apr 28 '15 at 4:50
HidingUITableViewCells and setting their height manually is a bad idea because they're managed and recycled by their parentUITableView. If you change the properties of a cell like hiding it it will remain hidden when recycled by itsUITableView.
– Tim Johnsen
Dec 7 '16 at 19:00
@TimJohnsen , please implement what you said, and then try scrolling your tableview, you will know the fact.
– Zaid Pathan
Dec 8 '16 at 5:25
You still shouldn't be hiding table view cells.
– Tim Johnsen
Dec 8 '16 at 18:53
The question is tagged Objective-C, not Swift. Answers should be in the appropriate language.
– rmaddy
Apr 27 '15 at 17:39
The question is tagged Objective-C, not Swift. Answers should be in the appropriate language.
– rmaddy
Apr 27 '15 at 17:39
7
7
Right but as an iOS developer changing code between these two is not a big problem.
– Zaid Pathan
Apr 28 '15 at 4:50
Right but as an iOS developer changing code between these two is not a big problem.
– Zaid Pathan
Apr 28 '15 at 4:50
Hiding
UITableViewCells and setting their height manually is a bad idea because they're managed and recycled by their parent UITableView. If you change the properties of a cell like hiding it it will remain hidden when recycled by its UITableView.– Tim Johnsen
Dec 7 '16 at 19:00
Hiding
UITableViewCells and setting their height manually is a bad idea because they're managed and recycled by their parent UITableView. If you change the properties of a cell like hiding it it will remain hidden when recycled by its UITableView.– Tim Johnsen
Dec 7 '16 at 19:00
@TimJohnsen , please implement what you said, and then try scrolling your tableview, you will know the fact.
– Zaid Pathan
Dec 8 '16 at 5:25
@TimJohnsen , please implement what you said, and then try scrolling your tableview, you will know the fact.
– Zaid Pathan
Dec 8 '16 at 5:25
You still shouldn't be hiding table view cells.
– Tim Johnsen
Dec 8 '16 at 18:53
You still shouldn't be hiding table view cells.
– Tim Johnsen
Dec 8 '16 at 18:53
add a comment |
You can't simply hide a UITableViewCell. You have to remove that cell from the table view then insert it again when you would like it to reappear in the table.
The methods you're looking for are deleteRowsAtIndexPaths:withRowAnimation: and insertRowsAtIndexPaths:withRowAnimation:. These are well documented in the UITableView documentation here. You're going to have to remember where you removed the cell from then insert it at the same position later.
Keep in mind that if you add cells to your table with a lesser row index than the row index of the deleted row, you will have to add on to the index to maintain it's relative position.
Hope this helps.
add a comment |
You can't simply hide a UITableViewCell. You have to remove that cell from the table view then insert it again when you would like it to reappear in the table.
The methods you're looking for are deleteRowsAtIndexPaths:withRowAnimation: and insertRowsAtIndexPaths:withRowAnimation:. These are well documented in the UITableView documentation here. You're going to have to remember where you removed the cell from then insert it at the same position later.
Keep in mind that if you add cells to your table with a lesser row index than the row index of the deleted row, you will have to add on to the index to maintain it's relative position.
Hope this helps.
add a comment |
You can't simply hide a UITableViewCell. You have to remove that cell from the table view then insert it again when you would like it to reappear in the table.
The methods you're looking for are deleteRowsAtIndexPaths:withRowAnimation: and insertRowsAtIndexPaths:withRowAnimation:. These are well documented in the UITableView documentation here. You're going to have to remember where you removed the cell from then insert it at the same position later.
Keep in mind that if you add cells to your table with a lesser row index than the row index of the deleted row, you will have to add on to the index to maintain it's relative position.
Hope this helps.
You can't simply hide a UITableViewCell. You have to remove that cell from the table view then insert it again when you would like it to reappear in the table.
The methods you're looking for are deleteRowsAtIndexPaths:withRowAnimation: and insertRowsAtIndexPaths:withRowAnimation:. These are well documented in the UITableView documentation here. You're going to have to remember where you removed the cell from then insert it at the same position later.
Keep in mind that if you add cells to your table with a lesser row index than the row index of the deleted row, you will have to add on to the index to maintain it's relative position.
Hope this helps.
answered Apr 27 '15 at 3:32
John RogersJohn Rogers
1,3111122
1,3111122
add a comment |
add a comment |
I am using Hidden in Attributes Inspector of TableViewCell -> ContentView and then implement method:
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if shouldHideSection(indexPath.section) {
return 0.0
} else if let isHidden = tableView.cellForRow(at: indexPath)?.contentView.isHidden, isHidden {
return 0.0
}
return super.tableView(tableView, heightForRowAt: indexPath)
}
I like the solution but I seem to be getting an overflow error when calling cellForRow
– bj97301
Aug 8 '18 at 0:44
add a comment |
I am using Hidden in Attributes Inspector of TableViewCell -> ContentView and then implement method:
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if shouldHideSection(indexPath.section) {
return 0.0
} else if let isHidden = tableView.cellForRow(at: indexPath)?.contentView.isHidden, isHidden {
return 0.0
}
return super.tableView(tableView, heightForRowAt: indexPath)
}
I like the solution but I seem to be getting an overflow error when calling cellForRow
– bj97301
Aug 8 '18 at 0:44
add a comment |
I am using Hidden in Attributes Inspector of TableViewCell -> ContentView and then implement method:
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if shouldHideSection(indexPath.section) {
return 0.0
} else if let isHidden = tableView.cellForRow(at: indexPath)?.contentView.isHidden, isHidden {
return 0.0
}
return super.tableView(tableView, heightForRowAt: indexPath)
}
I am using Hidden in Attributes Inspector of TableViewCell -> ContentView and then implement method:
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if shouldHideSection(indexPath.section) {
return 0.0
} else if let isHidden = tableView.cellForRow(at: indexPath)?.contentView.isHidden, isHidden {
return 0.0
}
return super.tableView(tableView, heightForRowAt: indexPath)
}
answered Mar 13 '18 at 10:25
Michał ZiobroMichał Ziobro
1,54512234
1,54512234
I like the solution but I seem to be getting an overflow error when calling cellForRow
– bj97301
Aug 8 '18 at 0:44
add a comment |
I like the solution but I seem to be getting an overflow error when calling cellForRow
– bj97301
Aug 8 '18 at 0:44
I like the solution but I seem to be getting an overflow error when calling cellForRow
– bj97301
Aug 8 '18 at 0:44
I like the solution but I seem to be getting an overflow error when calling cellForRow
– bj97301
Aug 8 '18 at 0:44
add a comment |
Same as Zaid Pathan but for Swift 4:
//HIDE you cell.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: NSIndexPath) -> UITableViewCell {
let myCell = tableView.dequeueReusableCell(withIdentifier: "cellID", for: indexPath) as! UITableViewCell
//hide second cell
indexPath.row == 1 ? (cell.isHidden = true): (cell.isHidden = false)
return myCell
}
//Set Height of cell to ZERO.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
indexPath.row == 1 ? (rowHeight = 0.0): (rowHeight = 49.0)
return rowHeight
}
add a comment |
Same as Zaid Pathan but for Swift 4:
//HIDE you cell.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: NSIndexPath) -> UITableViewCell {
let myCell = tableView.dequeueReusableCell(withIdentifier: "cellID", for: indexPath) as! UITableViewCell
//hide second cell
indexPath.row == 1 ? (cell.isHidden = true): (cell.isHidden = false)
return myCell
}
//Set Height of cell to ZERO.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
indexPath.row == 1 ? (rowHeight = 0.0): (rowHeight = 49.0)
return rowHeight
}
add a comment |
Same as Zaid Pathan but for Swift 4:
//HIDE you cell.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: NSIndexPath) -> UITableViewCell {
let myCell = tableView.dequeueReusableCell(withIdentifier: "cellID", for: indexPath) as! UITableViewCell
//hide second cell
indexPath.row == 1 ? (cell.isHidden = true): (cell.isHidden = false)
return myCell
}
//Set Height of cell to ZERO.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
indexPath.row == 1 ? (rowHeight = 0.0): (rowHeight = 49.0)
return rowHeight
}
Same as Zaid Pathan but for Swift 4:
//HIDE you cell.
func tableView(_ tableView: UITableView, cellForRowAt indexPath: NSIndexPath) -> UITableViewCell {
let myCell = tableView.dequeueReusableCell(withIdentifier: "cellID", for: indexPath) as! UITableViewCell
//hide second cell
indexPath.row == 1 ? (cell.isHidden = true): (cell.isHidden = false)
return myCell
}
//Set Height of cell to ZERO.
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
var rowHeight:CGFloat = 0.0
indexPath.row == 1 ? (rowHeight = 0.0): (rowHeight = 49.0)
return rowHeight
}
answered Nov 21 '18 at 8:02
Grzegorz R. KuleszaGrzegorz R. Kulesza
1714
1714
add a comment |
add a comment |
You should delete row and reload table view
[tbv reloadData];
1
Important to note that this will hide or show the row without animation.
– Tim Johnsen
Apr 27 '15 at 6:23
add a comment |
You should delete row and reload table view
[tbv reloadData];
1
Important to note that this will hide or show the row without animation.
– Tim Johnsen
Apr 27 '15 at 6:23
add a comment |
You should delete row and reload table view
[tbv reloadData];
You should delete row and reload table view
[tbv reloadData];
answered Apr 27 '15 at 4:01
Binladenit TranBinladenit Tran
93117
93117
1
Important to note that this will hide or show the row without animation.
– Tim Johnsen
Apr 27 '15 at 6:23
add a comment |
1
Important to note that this will hide or show the row without animation.
– Tim Johnsen
Apr 27 '15 at 6:23
1
1
Important to note that this will hide or show the row without animation.
– Tim Johnsen
Apr 27 '15 at 6:23
Important to note that this will hide or show the row without animation.
– Tim Johnsen
Apr 27 '15 at 6:23
add a comment |
cell display, depending on the data source, so you need to deal with the data source.
if dataArr is the table view datasource,first of all, you should delete the data source where the cell,then
[dataArr removeObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
at last ,you can insert data source when you should add a cell
[dataArr insertObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
add a comment |
cell display, depending on the data source, so you need to deal with the data source.
if dataArr is the table view datasource,first of all, you should delete the data source where the cell,then
[dataArr removeObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
at last ,you can insert data source when you should add a cell
[dataArr insertObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
add a comment |
cell display, depending on the data source, so you need to deal with the data source.
if dataArr is the table view datasource,first of all, you should delete the data source where the cell,then
[dataArr removeObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
at last ,you can insert data source when you should add a cell
[dataArr insertObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
cell display, depending on the data source, so you need to deal with the data source.
if dataArr is the table view datasource,first of all, you should delete the data source where the cell,then
[dataArr removeObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView deleteRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
at last ,you can insert data source when you should add a cell
[dataArr insertObjectAtIndex:indexpath.row];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:@[indexpath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
edited Apr 27 '15 at 6:03
answered Apr 27 '15 at 4:59
taitanxiamitaitanxiami
849
849
add a comment |
add a comment |
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
var rowHeight:CGFloat = 0.0
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
rowHeight = 240.0
}
else
{
rowHeight = 0.0
}
}
return rowHeight
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CompetitionTableViewCell") as! CompetitionTableViewCell
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
cell.isHidden = false
}
else
{
cell.isHidden = true
}
}
cell.selectionStyle = UITableViewCellSelectionStyle.none
return cell
}
While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review
– Nick
Dec 4 '18 at 22:30
add a comment |
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
var rowHeight:CGFloat = 0.0
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
rowHeight = 240.0
}
else
{
rowHeight = 0.0
}
}
return rowHeight
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CompetitionTableViewCell") as! CompetitionTableViewCell
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
cell.isHidden = false
}
else
{
cell.isHidden = true
}
}
cell.selectionStyle = UITableViewCellSelectionStyle.none
return cell
}
While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review
– Nick
Dec 4 '18 at 22:30
add a comment |
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
var rowHeight:CGFloat = 0.0
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
rowHeight = 240.0
}
else
{
rowHeight = 0.0
}
}
return rowHeight
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CompetitionTableViewCell") as! CompetitionTableViewCell
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
cell.isHidden = false
}
else
{
cell.isHidden = true
}
}
cell.selectionStyle = UITableViewCellSelectionStyle.none
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
var rowHeight:CGFloat = 0.0
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
rowHeight = 240.0
}
else
{
rowHeight = 0.0
}
}
return rowHeight
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "CompetitionTableViewCell") as! CompetitionTableViewCell
let dicttemp : Dictionary = arrAllCoursesList[indexPath.row] as! Dictionary<String,Any>
if let getStatus = dicttemp["status"] as? String
{
if getStatus == "1"
{
cell.isHidden = false
}
else
{
cell.isHidden = true
}
}
cell.selectionStyle = UITableViewCellSelectionStyle.none
return cell
}
answered Dec 4 '18 at 12:12
Davender Verma SoniDavender Verma Soni
475
475
While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review
– Nick
Dec 4 '18 at 22:30
add a comment |
While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review
– Nick
Dec 4 '18 at 22:30
While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review
– Nick
Dec 4 '18 at 22:30
While this might answer the authors question, it lacks some explaining words and/or links to documentation. Raw code snippets are not very helpful without some phrases around them. You may also find how to write a good answer very helpful. Please edit your answer - From Review
– Nick
Dec 4 '18 at 22:30
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%2f29886642%2fhide-uitableview-cell%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
1
You can add cell at particular position, same like you delete., have a look stackoverflow.com/questions/19503958/…
– Jageen
Apr 27 '15 at 3:27
1
You need to remove the cell and later insert the cell.
– rmaddy
Apr 27 '15 at 3:27
1
UITableView has insert/delete cell methods with animation option but you must manage your data source by yourself while you use these methods. developer.apple.com/library/ios/documentation/UIKit/Reference/…:
– Suttikeat Witchayakul
Apr 27 '15 at 3:29
I think you are looking for this. stackoverflow.com/a/28020367/3411787
– Zaid Pathan
Apr 27 '15 at 4:57
The
hiddenproperty you mention is actually onUIView, so you can hide any view. This however simply makes it invisible, it doesn't updateUITableView's accounting for the row height.– Tim Johnsen
Apr 27 '15 at 6:24