tableviewcell

How to only override a method depending on the runtime system iOS version?

五迷三道 提交于 2019-11-27 22:59:08
I've implemented automatic dynamic tableview cell heights for iOS 8 by using self.tableView.rowHeight = UITableViewAutomaticDimension; For pre-iOS 8, which does not support automatic dynamic cell heights, I overrided the heightForRowAtIndexPath method. This is a similar to what I did: Using Auto Layout in UITableView for dynamic cell layouts & variable row heights The problem is to how to write code that uses automatic cell height for iOS 8 but overrides heightForRowAtIndexPath for earlier iOS versions. I'd like my custom heightForRowAtIndexPath method only if iOS version is less than 8. Any

Grouped UITableview remove outer separator line

限于喜欢 提交于 2019-11-27 18:05:30
I have a grouped UITableview which is created programatically. Also I have a cell with xib file populated in tableview programmatically as well. So far so good. But I want to only remove outer separator line. I used below code but this time removed all separator line. self.tableView.separatorColor = [UIColor clearColor]; this is not good option for my situation. Here is the screenshot what i want to do; Qi Lee I just worked out a solution, as the cell has contentView which is a UIView , so I think you can just focus on the bottomline of contentView . Here is my code: first, you have to make

Expanding and collapsing UITableViewCells with DatePicker

这一生的挚爱 提交于 2019-11-27 17:06:44
I'm building an app that lets the user select dates from a UITableView. The tableView is static and grouped. I've looked through many questions, including this one , trying to figure out how to accomplish this - but nothing seems to work optimal. Apple's calendar app features a very smooth and nice animation that none of the examples I've been through have managed to recreate. This is my desired result: Could someone point me to a tutorial or explain how I can accomplish such a smooth animation with the most concise and straight forward way of doing it, like we see in the calendar app? Thanks

Dynamic tableViewCell height

假如想象 提交于 2019-11-27 16:29:50
I have a tableViewCell with a label inside that could be multiple lines tall. I've set the label's Lines property to 0. However, when I make the label's text have multiple lines the text gets cut off. Here's how I've set up my storyboard: Does anybody know how I made the table's cells just tall enough to contain the labels within? Setting Dynamic Cell height procedure Pin the label from top and bottom. Please refer following Screen shot Set numbers of line to 0 of the label as from property inspector of xcode, it can be done from code too please refer following screen shot Implement delegates

How can I fix crash when tap to select row after scrolling the tableview?

北城以北 提交于 2019-11-27 07:27:45
问题 I have a table view like this: when the user tap one row, I want uncheck the last row and check the selected row. So I wrote my code like this: (for example my lastselected = 0) func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { var lastIndexPath:NSIndexPath = NSIndexPath(forRow: lastSelected, inSection: 0) var lastCell = self.diceFaceTable.cellForRowAtIndexPath(lastIndexPath) as! TableViewCell var cell = self.diceFaceTable.cellForRowAtIndexPath(indexPath

Swipe-able Table View Cell in iOS 9

人盡茶涼 提交于 2019-11-26 23:31:28
I want my table list to have a swipe-able menu like in iOS 8 (first introduced in iOS 7). I've found a Ray Wenderlich guide that is clear on how to do it, but it was written a year and 4 months ago and the code is in Objective-C. Did iOS 8 or the upcoming iOS 9 finally include this function in Apple's SDK? I know they made the "swipe to reveal delete function" built-in years ago. I don't want to waste my time implementing patched-together code to mimic the iOS 8 mail function, if Apple's new iOS is going to hand it to me in a neatly wrapped package. jose920405 Try this. (Updated for Swift 3.0)

tableview cell how do we resize cell in swift along with image and label

为君一笑 提交于 2019-11-26 22:18:45
问题 when we have a lable and image in tableview cell how do we resize cell in swift or lable as per the text in the Last cell(in picture) there are some more lines of text but text is cutting off how we resolve it 回答1: Give constrain to your lable hight greater equal and put line to 0. var pickheight: CGFloat = 0.0 Write this line in override func viewDidLoad() { super.viewDidLoad() tableTrip.rowHeight = UITableViewAutomaticDimension } Method for increase tableview cell . func tableView(tableView

cast value of type 'UITableViewCell' to Custom Cell

為{幸葍}努か 提交于 2019-11-26 22:09:07
问题 I usually never have a problem with this step, but for some reason when I re set up my storyboard now I have an issue with this part of my code: func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("Cell") as! UITableViewCell (cell as! TableViewCell).usernameLabel.text = friendsArray[indexPath.row] as String return cell } I have done all of the obvious stuff like making sure the cell

UITableViewAutomaticDimension Not Working for Resizing Cell Height

蹲街弑〆低调 提交于 2019-11-26 21:52:30
问题 My cell displays fine as long as I don't try to enable the automatic resizing. When I add the two lines for auto-resizing in my viewController, everything under the profile picture, username, and date disappears (the cell is supposed to look like Instagram does when you click on a picture). If I comment out tableView.rowHeight = UITableViewAutomaticDimension tableView.estimatedRowHeight = 450 then the cell displays exactly like it is supposed to, but it obviously doesn't resize. This is the

How to only override a method depending on the runtime system iOS version?

一笑奈何 提交于 2019-11-26 21:16:47
问题 I've implemented automatic dynamic tableview cell heights for iOS 8 by using self.tableView.rowHeight = UITableViewAutomaticDimension; For pre-iOS 8, which does not support automatic dynamic cell heights, I overrided the heightForRowAtIndexPath method. This is a similar to what I did: Using Auto Layout in UITableView for dynamic cell layouts & variable row heights The problem is to how to write code that uses automatic cell height for iOS 8 but overrides heightForRowAtIndexPath for earlier