custom-cell

Set labels in a custom cell to names from an array using a separate controller

给你一囗甜甜゛ 提交于 2020-08-10 19:17:55
问题 I have a view controller with a table. The view controller has a button that segues to another controller with 4 textfields. There is a name textfield and three others where numbers can be inputed. When a user presses add, an array is appended and the view controller is dismissed while updating the table in the previous view controller. The user is then presented a table with a new cell added. The cell has 4 labels. I am trying to figure out how to set each label in a cell to the 4 textfields

UITableView custom cell - How to keep cornerRadius in edit mode

自闭症网瘾萝莉.ら 提交于 2020-08-08 04:01:54
问题 I implemented a tableview with custom cells. The cells have their cornerRadius set to 2. Everything displays just fine until I enter edit mode. When the delete button appears, it's corner radius is 0. How can I make the delete button have a cornerRadius too? I tried this without any luck: func tableView(tableView: UITableView, willBeginEditingRowAtIndexPath indexPath: NSIndexPath) { let cell = tableView.cellForRowAtIndexPath(indexPath) cell!.editingAccessoryView?.layer.cornerRadius = 2 } The

Swift Change the tableviewcell border color according to data

我与影子孤独终老i 提交于 2020-08-04 03:39:29
问题 I have written a code for making the cell border color change according to inStock or outStock , if it is inStock it will be red border else it would be green, but I it is not working for me, I put it in willDisplayCell and here is my code : func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath){ cell.backgroundColor = UIColor.clear cell.contentView.backgroundColor = UIColor.clear let whiteRoundedView : UIView = UIView(frame: CGRect(x:10,y:

Swift Change the tableviewcell border color according to data

核能气质少年 提交于 2020-08-04 03:39:09
问题 I have written a code for making the cell border color change according to inStock or outStock , if it is inStock it will be red border else it would be green, but I it is not working for me, I put it in willDisplayCell and here is my code : func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath){ cell.backgroundColor = UIColor.clear cell.contentView.backgroundColor = UIColor.clear let whiteRoundedView : UIView = UIView(frame: CGRect(x:10,y:

How to move the focussed text field to the middle of the view after keyboard popups

我怕爱的太早我们不能终老 提交于 2020-01-26 04:05:06
问题 In my iPad im creating SplitView application. I have a UITableVewtable with multiple rows, each row/cell having three UITextField When i tap on UITextField some fields are hide by the keyboard. So im using TPKeyboardAvoidingScrollView framework but it does not works on ios 5.0+. some times unable to scroll the scroll view on the table. So I want to move the focussed cell to the middle/ just above the key board at every time What should I use? Thanks in Advance. 回答1: Try this code. Put this in

Disable prepareForReuse for selected cell

不羁岁月 提交于 2020-01-17 04:14:09
问题 I have a custom UITableViewCell . When a cell gets selected, a UILabel gets added to it. I had to use prepareForReuse for it not to get messy, like so: - (void)prepareForReuse { NSArray *viewsToRemove = [self.view subviews]; for (UILablel *label in viewsToRemove) { [label removeFromSuperview]; } } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CategorieCell *customCell = [tableView dequeueReusableCellWithIdentifier:@"cellID"

How can I add combo Box In a Table cell using LWUIT — J2ME?

依然范特西╮ 提交于 2020-01-15 05:47:52
问题 I want to add a combo Box in table cell to provide drag n drop option LWUIT. I have used this option for it .. private String strCmbBox[] = { "1", "2", "3", "4" }; ComboBox comboRdoBox = new ComboBox(strCmbBox); comboRdoBox.setListCellRenderer(new comboBoxRenderer()); TableModel model = new DefaultTableModel(new String[] { "Col 1", "Col 2", "Col 3" }, new Object[][] { {"Row 1",new DefaultTableModel(new String[] { "1" }, new Object[][] { { comboRdoBox }, { "lbl" } }), "Row X" }, { "Row 2",

Setting off a function in another class

你离开我真会死。 提交于 2020-01-06 15:28:14
问题 I'm trying to set off a function in my custom tableViewCell-class by using a function in my view controller. I'm really clueless on how to do this, so I tried writing it like this: TableViewCell.timerStarted() The function I'm trying to set off looks like this: func timerStarted(){ timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: "update", userInfo: nil, repeats: true) } Where TableViewCell is the name of my class and timerStarted the name of the function. This gives

iOS tableView with time at the left

非 Y 不嫁゛ 提交于 2020-01-06 14:12:13
问题 I'm building an iOS app that would benefit from having the time from say 07:00 to 16:00 (specified by user) on the left of a UITableViewCell like this: What would be the best approach for such a behaviour, including the possibility of a colored rectangle over several cells? I imagine you would design a custom cell but it's the colored rectangle (appointments in the iOS calendar) logic that I'm not sure how to go about as it stretches over several cells. Could someone point me in the right