Reputation: 1085
This time the image of background still doesn't fit the scene,this is part of the code friendListCell
is the@IBOutlet
of the tableViewCell in this scene :
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!
}
Upvotes: 1
Views: 7321
Reputation: 3937
First: you shouldn't add the background image in `cellForRowAtIndexPath', which means that it will be set every time a new cell is added. Set it in viewDidLoad instead.
And I would suggest that you calculate the size of the background imageview like this instead:
let backGroundImage = UIImageView(frame: self.tableView.bounds)
Remove the white background by setting the cell's background color to UIColor.clearColor():
cell.backgroundColor = UIColor.clearColor()
Upvotes: 2
Reputation: 9389
You should set the tableView background image.
Try the following:
tableView.backgroundView = UIImageView(image: UIImage(named: "regularLogin.jpg"))
Also, if you want the cells to be transparent dont forget to set the cell color.
cell.backgroundColor = UIColor.clearColor()
Upvotes: 7