uitableview

adding some margin below section header text of a UITableView

南笙酒味 提交于 2020-02-02 06:50:07
问题 I have styled the header text: func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as? TableViewCell cell!.titleLabel!.text = sections[indexPath.section].objects[indexPath.row].name cell!.datetimeLabel!.text = "on " + sections[indexPath.section].objects[indexPath.row].date return cell! } func tableView(tableView: UITableView, heightForHeaderInSection

Two cells in one row in UITableView

无人久伴 提交于 2020-02-02 03:47:08
问题 I'm trying to build a grouped UITableView cell like the table in user details in Twitter's app (former Tweetie app). It's a cell with two sides, and you can select any of them separately (and the background turns blue, like a rounded button). Anyone did something like it or know how they made it? A screen shot from the view (it's the following, tweets, followers and favorites cells) 回答1: I was wanting to do the same in my own app, but I was also a bit clueless on how this was done in the

What's wrong with register(_:forCellWithReuseIdentifier:) on UICollectionView?

霸气de小男生 提交于 2020-02-02 02:43:05
问题 I'm working with an UICollectionView . As dequeueReusableCell(withReuseIdentifier:for:) expects You must register a class or nib file using the register(_:forCellWithReuseIdentifier:) method before calling this method , I added a line in my viewDidLoad func as self.collectionView!.register(PhotoCollectionViewCell.self, forCellWithReuseIdentifier: reuseIdentifier) Now when I'm using the cell for dequeuing and configuring, I'm getting error and app crashes. fatal error: unexpectedly found nil

How to properly implement a static cell with Swift 3

纵饮孤独 提交于 2020-01-31 15:11:29
问题 I literally could not find a single tutorial that showed me how to build an app that uses static cells; with clickable cells. Based on few out dated posted and object-c answers, I've put something together. My issue is, when I click on a cell, I get staticDemoTableCell is has no member present . I have embedded a Table Controller in my UIViewController. For that cell (only one so far), I've created a class: class staticDemoTableCell: UITableViewCell, UITableViewDelegate { @IBOutlet weak var

Swift custom UITableViewCell label is always nil

感情迁移 提交于 2020-01-31 06:18:11
问题 I've been stuck with this problem for days, so I'd be really happy if someone could help. I'm trying to create a dynamic UITableView, for which I created a custom UITableView subclass and I've created a custom UITableViewCell subclass as well, because I need several UILabels and a UIButton in each cell. The cell is created, but the problem is that the value of the labels is always nil, hence the cell isn't displayed properly. This is, how the storyboard looks like, and this is what I see

Swift custom UITableViewCell label is always nil

♀尐吖头ヾ 提交于 2020-01-31 06:17:05
问题 I've been stuck with this problem for days, so I'd be really happy if someone could help. I'm trying to create a dynamic UITableView, for which I created a custom UITableView subclass and I've created a custom UITableViewCell subclass as well, because I need several UILabels and a UIButton in each cell. The cell is created, but the problem is that the value of the labels is always nil, hence the cell isn't displayed properly. This is, how the storyboard looks like, and this is what I see

How to set up different Auto Layout constraints for different screen sizes

大城市里の小女人 提交于 2020-01-30 14:15:23
问题 I have a tableView with static cells. The cell contains an ImageView which fills it completely. And I have another smaller ImageViews atop. I position this ImageViews with constraints. I have a question about resizing the constraints. How can I set different constraint constants for different devices sizes without programming if/else loops. Is there a way to set it in the storyboard? I have a leading constraint to parent layout for example with an constant value of 10. This is okay for the

UIBarButtonItem action not work UITableView cell

回眸只為那壹抹淺笑 提交于 2020-01-30 12:24:50
问题 I create UIBarbUttonItem inside UITableView cell programmatically like this : func setupChildrenPicker(){ let chooseButton = UIBarButtonItem(title: Wordings.BTN_CHOOSE, style: UIBarButtonItemStyle.done, target: nil, action: #selector(self.pickerChildrenDonePressed)) } func pickerChildrenDonePressed(){ print ("pickerChildrenDonePressed") } override func awakeFromNib() { super.awakeFromNib() setupChildrenPicker() } but when I click that BarButtonItem, it not called pickerChildrenDonePressed()

How to apply tableview cell accessory to a tableview record

家住魔仙堡 提交于 2020-01-30 10:46:46
问题 Explanation: I have a UITableView that is being populated from JSON. The purpose of the tableview is for the user to select individual row records and have the checkmark accessory appear as a result. The issue is that while I can get the checkmark to appear for whichever row is selected the checkmark is applied to the row, not the record itself. For example, if I have two rows in the tableview and I select the first row, a checkmark is applied to it, but after updating the API to remove the

Replace action of swipe to delete by clicking on a button

≡放荡痞女 提交于 2020-01-30 05:53:04
问题 I have a tableview with a label and two buttons on each cell. At the moment I have this code that does a swipe to delete. - (void) tableView: (UITableView *) tableView commitEditingStyle: (UITableViewCellEditingStyle) editingStyle forRowAtIndexPath: (NSIndexPath *) indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { [appointments removeObjectAtIndex: indexPath.row]; // manipulate your data structure. [tableView deleteRowsAtIndexPaths: [NSArray arrayWithObject: indexPath]