![]() | 1 mmkkyang 2012-11-07 19:30:26 +08:00 ![]() 用表视图实现的话可在点击添加按钮的情况下numberOfRowsInSection 返回值加1 cellForRowAtIndexPath中对最后row实例一个带有UITextField的Cell UITextField成为第一响应者,滚动到最后一行可用scrollToRowAtIndexPath方法 不通过TableView实现的话可以在表视图上相应位置加一个UITextField视图 平时隐藏,点击添加按钮则滚动表视图,并显示UITextField BTW,需要用到CoreData不? |
![]() | 2 zhengwuzhou OP @mmkkyang numberOfRowsInSection是协议中的函数,请问如何在按钮点击事件中,改变numberOfRowsInSection的返回值呢? |
![]() | 3 zhengwuzhou OP @mmkkyang 我没有用到CoreData,我用的是NSArray直接writeToFile,生成了plist文件。 |
![]() | 4 alexrezit 2012-11-07 22:42:33 +08:00 你直接加在 footer 上面不行么... = =? |
![]() | 5 alexrezit 2012-11-07 22:52:56 +08:00 明白了. 添加行: [self.tableView insertRowsAtIndexPaths:<#(NSArray *)#> withRowAnimation:<#(UITableViewRowAnimation)#>]; 添加输入框: [cell.contentView addSubview:_inputTextView]; 滚动到最后一行: NSInteger numberOfSectiOns= self.tableView.numberOfSections; NSInteger numberOfRows = [self.tableView numberOfRowsInSection:numberOfSections - 1]; [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:numberOfRows - 1 inSection:numberOfSections - 1] atScrollPosition:UITableViewScrollPositionBottom animated:YES]; 虽然我很想损你一句: 读一下文档会死啊? |
![]() | 6 zhengwuzhou OP @alexrezit 你按照你的方法试试看能不能实现! |
![]() | 7 alexrezit 2012-11-07 23:53:19 +08:00 @zhengwuzhou 细节上要处理的远远不止这些, 你自己写呗. |
![]() | 8 zhengwuzhou OP @alexrezit insertRowsAtIndexPath压根不是答案 |
![]() | 9 alexrezit 2012-11-08 11:05:27 +08:00 @zhengwuzhou 为什么不是? |