ios - UITableViewCell background image setting -


I try to add a background image to my UITableViewCell . This is the code that I am using:

  - (UITableViewCell *) TableView: (UITableView *) Table View CellForAind Pump: (NSIndexPath *) Index Path {Fixed NSString * CellIdentifier = @ "TableCell "; // Create a deck or type of suitable type table cell * cell = (tableclay *) [tableview decouwer reusable cell identifier: cell identifier]; Cell.backgroundView = [[UIImageView alloc] initWithImage: [[UIImage imageNamed: @ "cellbg.jpeg"] Strenuous image with left capwidth: 0.0 topcaphight: 5.0]]; Cell.selectedBackgroundView = [[UIImageView alloc] initWithImage: [[UIImage imageNamed: @ "cellbg.jpeg"] Stretchable Image with Left Cap Width: 0.0 Top Caphite: 5.0]]; If (cell == zero) {NSArray * nib = [[NSBundle mainBundle] loadNibNamed: @ "tableclay" owner: self choice: zero]; Cell = [nib object at index: 0]; } [Cell. Prepaid Leback Set Font: [UIFont fontWithName: @ "bold" size: 20]]; // Configure cell if (btnselected == 1) {cell.preparationLabel.text = [recipe.ingredients objectAtIndex: indexPath.row]; } Other {Sale.Prepration Labels. Text = [recipe PREPARATION OBJECTINDEX: INDEXPath.RO]; } Return cell; }   

My problem is that while selecting the app and selecting Table Viewer, it shows the table with the default background of the cell for the first time and after some time the cell background to the desire image .. I do not know how long it takes to load a table view with my desired cell background "post-text" itemprop = "text">

Slow loading because you only want to create a new one Add UIImageView to the Joy cell.

Change your code as follows:

  // dequeue or make a cell of the appropriate type. Table cell * cell = (tableclay *) [tableview dequeware reusable cell with identifier: cell identifier]; If (cell == zero) {NSArray * nib = [[NSBundle mainBundle] loadNibNamed: @ "tableclay" owner: self choice: zero]; Cell = [nib object at index: 0]; Cell.backgroundView = [[UIImageView alloc] initWithImage: [[UIImage imageNamed: @ "cellbg.jpeg"] Strenuous image with left capwidth: 0.0 topcaphight: 5.0]]; Cell.selectedBackgroundView = [[UIImageView alloc] initWithImage: [[UIImage imageNamed: @ "cellbg.jpeg"] Stretchable Image with Left Cap Width: 0.0 Top Caphite: 5.0]]; }    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -