UITableview


tableview 最後一行顯示不全,能夠設置contentInset 設置偏移值.大多數由於tableview的高度不夠形成的.
分組與不分組的區別:
plain:向下拖動的時候,header和footer不隨着拖動.cell經常使用屬性:
imageview
textLabel
detailTextLabel
accessoryType
accessoryView

cell背景顏色屬性:
backgroundcolour
backgroundView
selectedbackgroundView
點擊顏色不一樣,能夠設置backgroundView 爲一個新的UIView,而後設置selectbackgroundVeiw 爲新View便可;
rowHeight 統一的行高
separatorColour 分隔線顏色
separatorStyle 分隔線樣式
tableHeaderView 通常放廣告
tableFooterView 通常能夠放加載更多
cell類型:

//這句話不顯示多餘的單元格 self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; //右邊字幕篩選
sectionIndexTitlesfortableview方法 // 這句話不顯示單元格之間的分割線 _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // 這句話在單元格的最後顯示一個箭頭 cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 能夠在後面箭頭的地方設置各類View,好比開關switch
cell.accessotyView = [UISwitch alloc]init]; //--- 點擊cell的時候 cell不會產生高亮狀態 --- cell.selectionStyle = UITableViewCellSelectionStyleNone; // --- 寫在viewdidload裏面cell自適應高度 ---- tableView.rowHeight = UITableViewAutomaticDimension; // 自適應單元格高度 tableView.estimatedRowHeight = 50; //先估計一個高度 // 去掉UItableview headerview黏性(sticky) - (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat sectionHeaderHeight = 40; if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) { scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); } else if (scrollView.contentOffset.y>=sectionHeaderHeight) { scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); } } // 獲取手勢點擊的是哪個cell的座標 NSIndexPath *indexPath = [self.tableView indexPathForCell:((UITableViewCell *)longPress.view)]; // 局部刷新 //一個section刷新 NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:2]; [tableview reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic]; //一個cell刷新 NSIndexPath *indexPath=[NSIndexPath indexPathForRow:3 inSection:0]; [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath,nil] withRowAnimation:UITableViewRowAnimationNone]; // 關於UITableView如何跳轉到最後一行或者任意指定行。 其實現以下: [self.chatTableView scrollToRowAtIndexPath: [NSIndexPath indexPathForRow:[self.chatArray count]-1 inSection:0] atScrollPosition: UITableViewScrollPositionBottom animated:NO]; // 點擊button時獲取button所在的cell的indexpath UIButton *button = sender; HeroDermaTableViewCell *cell = (HeroDermaTableViewCell *)[[button superview] superview]; NSIndexPath *indexPath = [_tableView indexPathForCell:cell];

Group:一塊兒拖動

 tableView 只刷新一行的方法:ui

NSIndexPath *index = [NSIndexPath indexPathForRow:alertView.tag inSection:0];spa

[self.tableView reloadRowsAtIndexPaths;@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];code

相關文章
相關標籤/搜索