我正在开发一个使用tabbar系统的项目.tabbar项目之一是JobPostingViewController.我将它嵌入UINavigationController中.在这个视图控制器中有一个名为add new job的UIButton.我实现了pushviewcontroller去CreateJobPostViewController.在那里我需要添加UIImagePickerController来选择图像.当我点击完成按钮或从库中选择一个图像时,它会关闭到JobPostingViewController.但它应该去CreateJobPostViewController.任何人请帮助我.提前致谢.
JobPostingViewController中的代码
@IBAction func openCreateJob(sender: AnyObject) {
let vc = self.storyboard?.instantiateViewControllerWithIdentifier("CreateJobPostViewController") as! CreateJobPostViewController
self.navigationController?.pushViewController(vc, animated: true)
}
Run Code Online (Sandbox Code Playgroud)
CreateJobPostViewController中的代码
@IBAction func addImages(sender: AnyObject) {
imagePicker.allowsEditing = false
imagePicker.sourceType = .PhotoLibrary
presentViewController(imagePicker, animated: true, completion: nil)
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
picker.dismissViewControllerAnimated(true, completion: nil)
}
func imagePickerControllerDidCancel(picker: UIImagePickerController) {
picker.dismissViewControllerAnimated(true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud) 我有一个 tableViewController,我的数据源运行良好,但我无法以编程方式选择行。
我努力了:
class DocumentTableViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
tableView.selectRow(at: IndexPath(row: 0, section: 0), animated: true, scrollPosition: UITableViewScrollPosition(rawValue: 0)!)
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行时,tableView什么也不选择。我该如何解决这个问题?