这次背景的图像仍然不适合场景,这部分代码friendListCell
是@IBOutlet
这个场景中tableViewCell的一部分:
override func viewDidLoad() { super.viewDidLoad() let BackGroundImage:UIImageView = UIImageView(frame: self.friendListCell.bounds)//UIImageView(frame: CGRectMake(0, 0, self.view.frame.width , self.view.frame.height)) let image: UIImage = UIImage(named: "regularLogin.jpg")! BackGroundImage.image = image friendListCell.backgroundView = BackGroundImage fetchRequest.sortDescriptors = [sortDescriptor] } override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { switch(segue.identifier) { case .Some("functionSegue"): let functionViewController = segue.destinationViewController as! FunctionsViewController functionViewController.client = client! default: super.prepareForSegue(segue, sender: sender) } } //let AppConfig = TransmissionAgreement(first:"first") var username:String? var password:String? var client:TCPClient? let fetchRequest = NSFetchRequest(entityName: "Friend") let sortDescriptor = NSSortDescriptor(key: "name", ascending: true) var result:[AnyObject]? var managedObjectContext:NSManagedObjectContext? @IBOutlet weak var friendListCell: UITableView! }
您应该设置tableView背景图像.
请尝试以下方法:
tableView.backgroundView = UIImageView(image: UIImage(named: "regularLogin.jpg"))
此外,如果您希望细胞透明,请不要忘记设置细胞颜色.
cell.backgroundColor = UIColor.clearColor()