Don't reuse cell in UITableView

前端 未结 3 1554
醉梦人生
醉梦人生 2021-01-18 11:48
let cell = tableView.dequeueReusableCellWithIdentifier(\"cellReuseIdentifier\", forIndexPath: indexPath) as! CustomTableViewCell

I don\'t want to r

3条回答
  •  不要未来只要你来
    2021-01-18 12:45

    If you have limited number of cell then only you should use this method

    On viewDidLoad() you can create NSArray of custom cell

     self.arrMainCell.addObject(your custom cell);
    
     func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return self.arrMain.count
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    
        let cell = self.arrMain.objectAtIndex(indexPath.row)
    
     }
    

提交回复
热议问题