FAQ Database Discussion Community


Dynamic UITableView rowheight and max row height using ios8 auto-resizing cell?

ios8,tableviewcell
I want to implement dynamic row height in UITableView with a max row height to limit the rows into such as no more than 10 lines(The row has only one label). If a row has less than 10 lines, its content will be displayed fully. If more than 10, it...

Add a UITableView to an existing ViewController

ios,objective-c,uitableview,addsubview,tableviewcell
I'm trying to add a UITableView to an existing UIViewController programmatically. My run.h file has this: @interface runTests : UIViewController <UINavigationControllerDelegate,UITextFieldDelegate,UIAlertViewDelegate,UITableViewDelegate,UITableViewDataSource> {NSTimer *Timer;} @property (strong, nonatomic) UITableView *tableView; My app runs through a speed test and at the end of the test I'm trying to add a TableView to the...

Fading out a disclosure indicator

ios,objective-c,uitableview,tableviewcell
I'm building an app where I've got cells that expand, similar to when you create a new event in iOS' built in calendar app. One of the expanding cells have a disclosure indicator set in storyboard, but return nil when logging it. I've tried to set it both in StoryBoard...

swift didSelectRowAtIndexPath can be called several times

ios,uitableview,swift,didselectrowatindexpath,tableviewcell
I'm having a problem with my tableview, I can tap on my cells just fine. But if I quickly tap the same cell twice. It runs the "didSelectRowAtIndexPath" twice. Adding 2 of the same views, to my navigation Controller Stack Here's the function: func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {...

Set Cell Background Color from index path corresponding Color in Parse

ios,objective-c,uitableview,parse.com,tableviewcell
I have a Table View, and I want to color the background of the cells based on the corresponding color I have stored in Parse. I can't figure out how to grab the color from the arrays corresponding cell and make it the background color of the cell. Any ideas?...

iOS Swift Button action in table view cell

ios,uitableview,parsing,swift,tableviewcell
I am trying to run an action for a button being pressed within a table view cell. The following code is in my table view controller class. The button has been described as "yes" in an outlet in my class of UITableViewCell called requestsCell. I am using parse to save...

Cell's progress bar duplicates on other cells

ios,uitableview,progress-bar,tableviewcell,reuseidentifier
I have a cell reuse problem. All my cells are identical, there is only one section. Cells include a label, button and progress bar. The button triggers a sound (it's a simple "play" button). When the AVAudioPlayers delegate method is called, audioPlayerDidFinishPlaying:, I nullify the NSTimer that updates the progress...

How to change CustomCell when it ends display?

swift,custom-cell,tableviewcell
I want to change this code: override func tableView(tableView: UITableView, didEndDisplayingCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) { } like that: override func tableView(tableView: UITableView, didEndDisplayingCell cell: CustomCell, forRowAtIndexPath indexPath: NSIndexPath) { } but I receive an error message. I need to change my CustomCell when it disappears. How can I...

Issue with Swift TableViewCell: change background color for selected row

swift,tableviewcell,uibackgroundcolor
I have a strange issue with my tableView. I have a List of audio tracks and a segue to an audio player in order to play the selected track at a specific row. Everything works fine! I wanted to change the background color for the selected row in the table...

ios 8 swift - how to add footer for tableview using separate datasource

ios,uitableview,swift,tableview,tableviewcell
For 2 days I'm trying to solve this. I just want to add a footer (custom cell) to my tableview. I have a view with some stuff on it (labels, buttons) and I've added a tableview. To have a clean controller, for the datasource I'm using a separate file: class...

swift getting data for selected cell in another ViewController (programatically)

ios,uitableview,swift,tableviewcell
This question has been answered many times. But the answers I could find on it, didn't work for me, cause I can't seem to call the cell's class. to further explain: I have a viewController, with a UITable. The cells are configured in a UITableViewCell class. (it's from this class...

Swift : Pass TableViewCell text to new ViewController's cell

ios,uitableview,swift,segue,tableviewcell
How to pass the same text from tableVC to the detail tableVC using an array populated in tableVC. It is working in tableVC but no data passed into the detailVC. They share one tableviewcell. class TableViewCell: UITableViewCell { @IBOutlet var img: UIImageView! @IBOutlet var title: UILabel! } tableVC class TableViewController:...

Change UILabel textColor when UITableViewCell is highlighted?

ios,objective-c,uitableview,tableviewcell
I have a custom UITableViewCell, with an UILabel and an UIImageView. I want to change the background color and the text color when the cell is highlighted. In my CustomCell's setHighlighted method, I have the following piece of code: -(void)setHighlighted:(BOOL)highlighted { [super setHighlighted:highlighted]; if(self) { if(highlighted) { self.title.textColor = [UIColor...

iOS - How to present different scenes from UITableViewCell

ios,objective-c,uiviewcontroller,tableview,tableviewcell
I have a UIViewController with a TableView. The TableView is populated with an image and a text for each cell. Now I need to present others Scenes when the user taps a cell. For example: - tap on first row --> present ViewController1 - tap on second row --> present...

Image from XML to Cell

image,swift,asynchronous,tableviewcell
i wanted to load ASYNC an Image to a Cell. my Code is: override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("Cell") as xmlParserDatenCell dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { var test = UIImage(data: NSData(contentsOfURL: NSURL(string: daten[imagePath.row]["bildlink"]!)!)!) cell.bild1.image = test }) my answer from this is nil. No...

Move custom UITableViewCell to the end of UITableView

ios,objective-c,uitableview,swift,tableviewcell
I have a custom UITableView cell where I implement a swipe-to-the-right gesture and I want the cell to go to the end of the table view once its swipe gesture is detected. Here is my code: // Override methods override func awakeFromNib() { super.awakeFromNib() // Initialization code var swipeRight =...

How to display and hide table view cells in swift

ios,iphone,swift,tableviewcell
I have a tableView with two different custom cell. One cell have few textfields data and other also have different textfield data,here i need to collapse and hide the each cell. i don't know how to do this.Please let me know. https://maniacdev.com/2013/03/an-open-source-ios-control-allowing-you-to-create-great-looking-collapsible-lists-without-uitableview Please refer the above link, i want the...

How to access the content of a custom cell in swift using button tag?

uitableview,swift,uibutton,tags,tableviewcell
I have an app that has a custom button in a custom cell. If you select the cell it segues to the a detail view, which is perfect. If I select a button in a cell, the code below prints the cell index into the console. I need to access...

checkbox button in tableview in Swift

swift,checkbox,tableview,tableviewcell
I'm trying to create a checkbox functionality in a tableview . It's a to-do list where if the checkbox is pressed the cell hides and appears as completed in a different section. Coming from C# this was very straightforward to do but in swift there isn't even a checkbox button...

UILabel does not wrap on initial load within TableViewCell

ios,swift,uilabel,tableviewcell
I am creating a chat based app, which uses a UITableView to hold all the messages within a conversation. To create a chat bubble, I have a wrapper view (wrapView) which is constrained to the top, bottom, right, and left of the TableViewCell. As a subview I have a UILabel...

Auto size of table view cell does not appear to work in a standard UIViewController class

ios,uitableview,swift,autosize,tableviewcell
I have created a test project in order to verify this problem. In the project storyboard I have two scenes. One scene is based on the initial ViewController that was added to the single view application when the project was created. The second scene was created by dragging a UITableViewController...

Passing information to a custom TableViewCell - Swift

uitableview,swift,delegates,datasource,tableviewcell
The problem is this: I tried many ways to pass down information to a ViewController1 from a SecondViewController. In this first ViewController1 I have a tableView, and in this tableView, each cell will receive an image and a label. What I want to do is, in the SecondViewController, I will...

Custom UI TableViewCell selected backgroundcolor swift

swift,selected,tableviewcell
I am trying to change the appearance of a custom selected TableViewCell using Swift. Do I need to do it via the designer or programmatically? I tried the following: http://i60.tinypic.com/1yv3ah.png And here is my code: @IBOutlet var tableView: UITableView! var tableData: [String] = ["One", "Two", "Three", "Four"] override func viewDidLoad()...

Inline UIPicker Implementation

ios,objective-c,uitableview,uipickerview,tableviewcell
I'm attempting to implement an inline UIPicker inside a table-view cell, similar to both this and this SO question. I believe I'm close in my implementation, but at the moment, no picker is displayed when I select the appropriate cell. Can anyone point me in the right direction in regards...

UITableViewCell reorder clears subview's background color

ios,objective-c,iphone,uitableview,tableviewcell
This question has been asked few times but there don't seem to be any solution to this. UITableView reorder hides background Subviews of UITableViewCell are not visible while reordering Reordering causing subview 's backround color to clear I have a custom tableview cell with UILabel in it. When tableview is...

Get cell value in tableView

ios,objective-c,uitableview,tableviewcell
I want to get cell value in tableView by using: -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *selectedCell=[tableView cellForRowAtIndexPath:indexPath]; NSLog(@"selected cell: %@", selectedCell); } It should be a String but this is what i get in the NSLog: selected cell: <RewardCategoriesTableViewCell: 0x7ae11290; baseClass = UITableViewCell; frame = (0 92.01; 320 44);...

swift: send value back to UITableViewController from dynamic cell with UIDatePicker

swift,datepicker,tableview,tableviewcell
I've got a dynamic table with a cell for a UIDatePicker. There's a function in the UITableViewCell class that updates a variable when the picker changes. I'm just having trouble getting that value back to the UITableViewController class. I can print the correct variable while spinning the picker, but when...

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

ios,xcode,swift,uitableview,tableviewcell
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:...

Parse/Swift Issue with tableviewcell “binary operator '==' cannot be applied to operands of type cell and nil”

ios,xcode,swift,parse.com,tableviewcell
I've an issue with Parse/Swift using Xcode 6.3 beta override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath , object: PFObject) -> PFTableViewCell { var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! secTableViewCell if cell == nil { cell = secTableViewCell(style: UITableViewCellStyle.Default , reuseIdentifier: "cell") } // Configure the cell... cell.title.text = (object["exams"]...

Reusing a UITableViewCell's IBOutlets with two different UITableViewControllers

swift,uitableview,code-reuse,iboutlet,tableviewcell
I'm creating a coffee timer as a learning exercise and I want to have a different menu based on the brewing method selected. I'm storing my settings in NSUserDefaults and populating my tables with two separate arrays that look like this: var aero = ([ "Cool Down Time Enabled" :...

change constraint inside tableViewCell

ios,objective-c,uitableview,constraints,tableviewcell
I need to change a width constraint of a UIView inside a UITableViewCell. Usually I would create an IBOutlet to the constraint but how do I go about that as it's a dynamic prototypes tableView ? Please suggest Thanks!...

Custom tableview scrolling issue on cells

ios,uitableview,swift,scroll,tableviewcell
I have a programatically created tableview var tableView: UITableView = UITableView() var items = ["1","2","3","4","5","6"," 1","L 2","La 3","La 4","La 5","La 6","L 7","La 8","La 9","La 10","La 11","Lab 12","Lab 13","Lab 14","Lab 15","Lab 16","Lab 17","Lab 18","Lab 19","Lab 20","La 1","L 2","La 3"] override func viewDidLoad() { super.viewDidLoad() tableView.frame = CGRectMake(0, 50, self.view.frame.width,100); //If we...

Add a subview to a UITableView cell's view

ios,objective-c,uitableview,tableviewcell
I'm attempting to add a subview (which contains a UIDatePicker) to the view of a UITableView cell when that cell is selected. However, when I select that cell, the content of the subview is not being displayed. Below is where I check to see if the user selects the cell...

Swift UItableView Custom cell programatically (documentation)?

ios,uitableview,swift,tableviewcell
I've been trying to find some documentation/tutorial/examples. On how to do an advanced tableview in swift. But I've come up empty besides the endless storyboard tutorials. I'm doing this without storyboards and nibs. And I havn't been able to find any documentation beyond's Apple's /poorly/ explained library. Rather than trying...

Swift: TableView controller and segment value change

ios,uitableview,swift,tableviewcell
I hope you can help me on this question as I'm a bit stuck... In my app I have a simple TableView controller with a couple of custom prototype cells. In one of the custom prototype cells I have a segment control with two values (in my case are temperature...

Make Content visible when UITableView is selected

ios,objective-c,uitableview,tableviewcell
I'm using this method to enlarge the height of my cell when it is selected. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView beginUpdates]; [tableView endUpdates]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if([indexPath isEqual:[tableView indexPathForSelectedRow]]) { return 100.0; } return 44.0; } I want to display a UIImageView in the...

How to change UILabel text color on Custom UITable cell?

objective-c,uilabel,tableviewcell,swrevealviewcontroller,viewwithtag
I've created a table view controller on storyboard. I want to change UILabel text color to green when i clicked on the selected row. I'm trying something like this, but it's not working: - (void)viewDidLoad { [super viewDidLoad]; menuItems = @[@"home", @"stamp", @"scanner", @"settings"]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath...

How to detect multiple buttons in tableview cell

ios,objective-c,tableviewcell
How to detect multiple buttons in tableview cell and my doubt is with example i have 3 buttons in cell if i tap on one button that button will change colour and and if i click indexpath.row=1 cell button that button will color also need to change help me

How to add a button to a table view cell in iOS?

ios,uitableview,swift,tableviewcell
I'm creating a productivity app in Swift. I'm not using a prototype cell in the Storyboard as most of it has been written in code already. I'd like to a checkbox button. How would I go about doing that?

Adding a separator to UITableViewCell

ios,objective-c,uitableview,tableviewcell
I'm build an app (iOS 8.0) whereas I've got a UITableViewControlled built using AutoLayout and Storyboards. The tableView is set up as static & grouped, and the tableView separator is set to none. I'm trying to use this code (called in viewWillAppear:) to add a separator to two other cells,...