Posts

Showing posts with the label uitableview

Who is calling reloadData method for UITableView

Who is calling reloadData method for UITableView It can sounds weird but I don't understand why my tableView is showing cells. I got array of items that should be shown in cells but I don't run reloadData method of my tableView anywhere in my code. It seems that some of app components or maybe frameworks inside app is calling reloadData method and I want to find out which one? reloadData reloadData How it can be done? why this is a problem? reloadData shouldn't be overridden (there is no reason). – Marek R Jun 30 at 6:35 reloadData the problem is that tableView is showing content before it is properly prepared – moonvader Jun 30 at 7:15 you are barking ...

Make the last row in UITableView appear at top

Make the last row in UITableView appear at top I have a UITableView with a random number of custom cells. It's working fine. I am moving the selected cell to the top of the UITableView with: tableView.scrollTo(index path animated) However, when the selected cell is on the last full 'page' of cells, this doesn't work - obviously. Can I make this work by somehow 'padding' out the table with empty space, dependent on the Y position of the selected cell, so that even selecting the last row, it would animate and move to the top of the table view? I thought: let point = CGPoint(x: 0, y: 200) tableView.setContentOffset(point, animated: false) would work, but it didn't (the 200) was a test amount. I'm sure this is possible, could I please get a pointer? 2 Answers 2 If you want to allow a table view to be scrolled far enough for the last row to reach the top of the screen, set...

Circular image is square on first table refresh

Image
Circular image is square on first table refresh I have a search bar connected to my UITableView . UITableView Here is my code so far: func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = SongPicker.dequeueReusableCell(withIdentifier: "cell")! // Image cell.imageView?.image = songHandler.songItems[indexPath.row].songImage?.cropToBounds() cell.imageView?.layer.cornerRadius = cell.imageView!.frame.width / 2 cell.imageView?.layer.masksToBounds = true cell.imageView?.layer.borderWidth = 3 cell.imageView?.layer.borderColor = UIColor.lightGray.cgColor // Song name cell.textLabel?.text = songHandler.songItems[indexPath.row].songName // Artist name cell.detailTextLabel?.text = songHandler.songItems[indexPath.row].songArtist return cell } ( SongPicker is my table) SongPicker By printing out the result of cell.imageView?.layer , I can see that when the images first load, they do no...

UITableView doesn't show content of the custom cell?

UITableView doesn't show content of the custom cell? I'm beginner in iOS, so bear with me. I have several problems. First: When app is launched, search bar should be hidden, and when user swipes down the search bar should appear like this: when the app is launched Second: When user taps on search bar, the table view should show cells like this: when user taps search bar but for some reason table view won't show the content of said cell, it shows the name of the store in search bar: shows only name of the store(I connected delegate and dataSource). This is my code: import UIKit import Foundation class LOSocialWallPublicViewController: UIViewController, UISearchBarDelegate { //MARK: Variables let screenWidth = UIScreen.main.bounds.width let screenHeight = UIScreen.main.bounds.height var searchController = UISearchController() var suggestionsTableView: UITableView? var hidesSearchBarWhenScrolling = true var storeTableView: UITableView? var dat...

how to call popviewcontroller in UITableViewCell

how to call popviewcontroller in UITableViewCell The current structure is firstViewController -> pushViewController(SecondViewController) -UIViewController ->filename : secondViewController -UITableView -UITableViewCell (custom cell) ->filename : secondTableViewCell -UICollectionView -UICollectionViewCell (custom cell) ->filename : secondCollectionViewCell When 'didSelectItemAt' is done in the 'UICollectionView' I would like to call the 'popviewcontroller' from UIViewController. And I want to pass the data on the selected item to firstViewController. but i don't know how ** ViewController ** struct cellStat{ var opened = Bool() var title = String() var sectionData = [ItemModel]() } //선물 카테고리 리스트 보여주는 모달 class GiftCategoryModalVC: UIViewController { @IBOutlet weak var tableView: UITableView! private var categoryTitleModels: [ItemModel] = private var giftItemModels: [Item...