我在iOS8中有一个像这样的表格视图:
tableView = UITableView(frame: view.bounds, style: .Plain)
view.addSubview(tableView)
Run Code Online (Sandbox Code Playgroud)
当用户在键盘中键入并发送一些文本时,应用程序会调用以下方法来滚动tableView.目标是在屏幕上查看新文本(如聊天)
let numberOfRows = tableView.numberOfRowsInSection(0)
if numberOfRows > 0 {
let indexPath = NSIndexPath(forRow: numberOfRows-1, inSection: 0)
tableView.scrollToRowAtIndexPath(indexPath, atScrollPosition: UITableViewScrollPosition.Bottom, animated: animated)
}
Run Code Online (Sandbox Code Playgroud)
但表视图不会滚动到bootom.
有人有解决方案吗?
谢谢.
说明:
课程定义:
class ChatViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UITextViewDelegate
Run Code Online (Sandbox Code Playgroud)
然后我有表视图的定义:
var tableView: UITableView!
Run Code Online (Sandbox Code Playgroud)
在viewDidLoad中:
tableView = UITableView(frame: view.bounds, style: .Plain)
tableView.dataSource = self
tableView.delegate = self
view.addSubview(tableView)
Run Code Online (Sandbox Code Playgroud)
然后我调用了应该进行滚动的代码(我的答案中的第二个代码块).当我启动应用程序时,我希望tableview向下滚动,但它不起作用.
我已经完成了所有这里提到(https://www.parse.com/docs/ios_guide#fbusers/iOS)在iOS登录Facebook.
问题是我在che line附近有一个编译错误"使用未解析的标识符PFFacebookUtils"
PFFacebookUtils.initializeFacebook()
在AppDelegate中.我已经正确地将Parse和Facebook Framework导入到我的项目中.在Xcode 6 Beta中是否有一些错误?