0
我想隱藏一個擴展的tableviews標籤,當單元格展開並隱藏一個按鈕時,它摺疊。我在另一個類中有我的單元實現,標籤的屬性和標題中的按鈕。問題是,當我在ExpandedViewController中調用這些單元格方法時,代碼會進入該方法,但不會更改屬性行爲。你能幫我解決這個問題嗎?擴展後的桌面標籤在展開時如何隱藏? - IOS
謝謝
ExpandedCell.h
@property (nonatomic, retain) IBOutlet UILabel *lblTitle;
@property (strong, nonatomic) IBOutlet UIButton *setTime;
ExpandedCell.m
(void)setIfHidden:(BOOL)showIfHidden
{
if (showIfHidden)
{
[self.lblTitle setHidden:YES];
[self.setTime setHidden:NO];
}
else
{
[self.lblTitle setHidden:NO];
[self.setTime setHidden:YES];
}
}
ExpandedViewController.m
import ExpandedCell.h
。
(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([indexPath isEqual:self.expandedIndexPath])
{
return CELL_HEIGHT_EXPANDED;
}
else
{
return CELL_HEIGHT_COLLAPSED;
}
}
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.expandedIndexPath = ([self.expandedIndexPath isEqual:indexPath]) ? nil : indexPath;
ExpandedCell *hideCell = [[ExpandedCell alloc] init];
showIfHidden = YES;
[hideCell setIfHidden:showIfHidden];
[tableView beginUpdates];
[tableView endUpdates];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
https://github.com/bennyguitar/ CollapseClick https://github.com/iSofTom/STCollapseTableView 檢查此。 – KethanKumar