草庐IT

tableviews

全部标签

ios - 我想在 iOS tableview 中实现分页

关闭。这个问题需要更多focused.它目前不接受答案。想改进这个问题吗?更新问题,使其只关注一个问题editingthispost.关闭6年前。Improvethisquestion我需要在iOStableview中像google一样实现水平分页。有什么方法可以使用单个tableview来做到这一点吗?您能建议一种方法吗?

IOS:两个tableview的tableview委托(delegate)方法

我在一个类中有一个TableView的委托(delegate)方法:-(NSInteger)numberOfSectionsInTableView:(UITableView*)tableView{return1;}-(NSInteger)tableView:(UITableView*)tableViewnumberOfRowsInSection:(NSInteger)section{return[array1count];}-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndex

ios - 是否可以将观察者添加到 tableView.contentOffset 中?

我需要跟踪tableView.contentOffset.y是否可以将观察者添加到tableView.contentOffset?我认为这是不可能的,因为contentOffset没有继承NSObject类。还有其他解决办法吗? 最佳答案 UITableView是UIScrollView的子类,因此您可以使用UIScrollViewDelegate方法scrollViewDidScroll:在View滚动。检查该方法中scrollView的contentOffsetcontentOffset是关键路径,所以也可以用KVO观察它的变化

iphone - TableView 应用因 'NSInternalInconsistencyException' 而终止

我正在尝试掌握UITableViews及其相关的一切。目前我有以下代码:-(NSInteger)tableView:(UITableView*)tableViewnumberOfRowsInSection:(NSInteger)section{return10;}-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*CellIdentifier=@"Cell";UITableViewCell*cell=[tableV

ios - tableView.rx.itemSelected 中的 RxSwift 双映射

我想从tableView.rx.itemSelected获取对象并对其进行处理。此方法返回IndexPath,因此我可以映射此值。但是如何从ViewModel获取索引处的对象呢?structViewModel{varitems:Observable}大约我期望这样的事情(但这个流程是错误的):tableView.rx.itemSelected.map{indexPath->IteminreturnviewModel.items.map{$0[indexPath.row]}}..subscribe(onNext:{[unownedself]itemin//otheractionswith

ios - 以编程方式选择 TableView 单元格 : selectRowAtIndexPath vs setSelected

我经常需要将表格View单元格设置为初始选定状态,对此我使用以下代码:[self.tableViewselectRowAtIndexPath:indexPathanimated:NOscrollPosition:UITableViewScrollPositionNone];UITableViewCell*cell=[self.tableViewcellForRowAtIndexPath:indexPath];[cellsetSelected:YES];cell.accessoryType=UITableViewCellAccessoryCheckmark;我正在同时使用selectRo

ios - 在 TableView iOS 中添加一行

我是iOS开发的新手,尝试一些本应简单的事情让我感觉很糟糕;每次用户单击现有行之一时在TableView中添加额外的行。该操作没有实际目的,我只是想了解TableView的行为。所以我做了以下事情:我使用了基于SplitView的模板,并将RootViewController中的行数更改为30。-(NSInteger)tableView:(UITableView*)aTableViewnumberOfRowsInSection:(NSInteger)section{//Returnthenumberofrowsinthesection.return30;}tableView:didSe

ios - 键盘隐藏后 UISearchDisplayController tableview 内容偏移量不正确

我有一个UISearchDisplayController,它在表格View中显示结果。当我尝试滚动tableview时,contentsize恰好比应有的高_keyboardHeight。这会导致错误的底部偏移。tableview中有>50项,因此不应有如下空格 最佳答案 我通过添加一个NSNotificationCenter监听器解决了这个问题-(void)searchDisplayController:(UISearchDisplayController*)controllerwillShowSearchResultsTabl

ios - 一个 View Controller 中的两个 TableView

这个问题在这里已经有了答案:2UITableViewsinoneUIView(5个答案)关闭8年前。我在一个ViewController中有一个按钮和两个tableViewControllers。所以,如果我按下那个按钮,第一个TableViewController就会出现,它会在行中显示一些数据。如果我选择第一个TableViewController中的任何行,第二个TableViewController将出现,它需要显示第一个TableViewController所选行的相应数据。在这里,我们必须在一个ViewController中一次对2个TableViewController使

ios - 最佳实践 : handling actions from buttons inside tableview cells?

我有一个“联系人列表”TableView,其中包含一个电子邮件按钮的“联系人”单元格,点击该按钮时,应该会向电子邮件编辑器显示该联系人的电子邮件地址。将UIButton与该单元格的“联系人”实例相关联的最佳方式是什么?我已经为想到的两种方法创建了答案——但我并不真正满意。您更喜欢哪个,或者更好,建议更好的! 最佳答案 方法二:让单元格处理操作并调用自定义委托(delegate)方法。//YMContactCell.h@protocolYMContactCellDelegate-(void)contactCellEmailWasTap