我一直在努力尝试,已经查阅了 StackOverflow 上所有与这个问题相关的类似问题并且尝试了它们,但都没有成功。
class TimeLineTableViewController:
UITableViewController,
UIImagePickerControllerDelegate,
UINavigationControllerDelegate {
var timelineData = [PFObject]()
required init(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override func viewDidLoad() {
super.viewDidLoad()
self.loadData()
}
@IBAction func loadData(){
timelineData.removeAll(keepCapacity: false)
var findTimelineData:PFQuery = PFQuery(className:"timelineMessages")
findTimelineData.findObjectsInBackgroundWithBlock { (objects:[AnyObject]! , error:NSError!) -> Void in
if error == nil {
self.timelineData = objects.reverse() as [PFObject]
//let array:NSArray = self.timelineData.reverseObjectEnumerator().allObjects
// self.timelineData = array as NSMutableArray
self.tableView.reloadData()
}
}
}
override func viewDidAppear(animated: Bool) {
var footerView:UIView = UIView(frame: CGRectMake(0, 0, self.view.frame.size.width, 50))
self.tableView.tableFooterView = footerView
var logoutButton:UIButton = UIButton.buttonWithType(UIButtonType.System) as UIButton
logoutButton.frame = CGRectMake(20, 10, 50, 20)
logoutButton.setTitle("Logout", forState: UIControlState.Normal)
logoutButton.addTarget(self, action:"logout:", forControlEvents: UIControlEvents.TouchUpInside)
footerView.addSubview(logoutButton)
}
需要澄清的是,timelineTableViewController有一个继承的类MessageTableCell。它还是我整合到Objective-C代码中的项目的一部分,因此它同时包含Swift和ObjC。我已经独立运行了这两个项目(Swift和ObjC),它们都能正常工作;只有当我尝试将它们一起运行时,它们才会出问题。有什么建议吗?我对此完全不知所措。