uitableview

Set matching font sizes on UILabels in a UITableViewCell when one Label adjustFontSizeToFitWidth

最后都变了- 提交于 2020-01-13 14:38:12
问题 I have two UILabel in a custom tableViewCell . One label has width constraints and is set to adjustFontSizeToFitWidth on smaller screens e.g. 5S. How can I get the other UILabel to match the font size of the first label, when it does not have particular width constraints? It seems sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode: was deprecated in iOS7, so what is the Swift solution? This answer When do adjustsFontSizeToFitWidth or boundingRectWithSize change the context

Is there a recommended image size for UIContextualAction icons?

隐身守侯 提交于 2020-01-13 13:11:38
问题 New in iOS 11, UIContextualAction provides a convenient way to implement swipe actions on UITableView cells, with a title and/or image icon. I haven't found any mention in the Human Interface Guidelines of the image used by UIContextualAction. Does any information exist that defines a standard size or other design guidance for this icon image? I tried to figure this out by testing a few image sizes to see if iOS would scale it to a consistent size, but it seems to just display whatever you

Detect when a UITableView is being reordered

佐手、 提交于 2020-01-13 11:28:30
问题 I have a UITableView backed by an NSFetchedResultsController which may trigger updates at any time. If the user is currently reordering rows, applying these updates will cause an exception because the table view has temporarily taken over and you get an error like Invalid update: invalid number of rows in section [...] How can I detect when the user has started moving a cell so I can delay updates caused by the fetched results controller? There don't seem to be any table view delegate methods

Prevent footer overlapping tableViewCell in UITableView - Swift

拜拜、爱过 提交于 2020-01-13 11:06:29
问题 I have this table view which works how i want it to however i have a problem where the footer overlap the cells in the table view as seen in How can i prevent this? This is my code for the footer func tableView(tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { let footerView = UIView(frame: CGRectMake(0, 0, tableView.frame.size.width, 40)) // self.myTableView.tableFooterView = footerView; let sectionString = Array(foodArray.keys)[section] for value in caloriesArray

How to get touch coordinates upon SELECTING a custom UITableViewCell?

我与影子孤独终老i 提交于 2020-01-13 09:23:08
问题 When I touch (Touch Up) a UITableViewCell my ViewController's UITableViewDelegate method - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath is called. I need to get the x-coordinate of the Touch-Point at this time as well so that I can know what portion of the Cell was touched (non-accessory items). I have tried using the usual touch methods such as TouchesDidEnd but the coordinates always return x=0.000 y=0.000 no matter where I touched (A location in

UITableView separators drawn incorrectly through cell reuse?

我只是一个虾纸丫 提交于 2020-01-13 09:15:42
问题 I'm working on an iOS 5 project with storyboards, and thus using dynamic table cell prototypes in IB. In one of the views, I've got a table view with variable-height cells, with the cell height calculated from the height of the contents. tableView:heightForRowAtIndexPath: returns correct values for all cells when the table view is first displayed. All is well when scrolling down for a few items, but then something goes amiss: the actual cells seem to be correct height, including their touch

How to get section header from UItableView

时光毁灭记忆、已成空白 提交于 2020-01-13 07:56:30
问题 I am trying to get section header view using this code: [tableView headerViewForSection:indexPath.section]; but this code always returns me nil. Could you give me some examples to get section header view from table view? This is my viewForHeader implementation: - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { DynamicHeader *headerView = [[DynamicHeader alloc] init]; headerView.frame = CGRectMake(0, 0, 320, 40); UILabel *headerLbl = [[UILabel alloc]

Swift: how to populate UITableView with SQLite column

ぃ、小莉子 提交于 2020-01-13 07:18:29
问题 I would like to populate a basic UITableView (one-row cells) with a one-column coming from a SQLite database query. How can I do that in Swift? 回答1: I found the solution using the SQLite.Swift library! Very simple actually. Here is an example with an sqlite database of cities, using a UITextField to type the name of the city, and a UITableView to display the matching results while typing. import UIKit import SQLite let path = NSBundle.mainBundle().pathForResource("cities", ofType: "sqlite")!

add Toolbar above UITableView for use in UISplitViewController detail view

Deadly 提交于 2020-01-13 06:43:49
问题 I want to use a table view as the detail pane in my UISplitViewController. How do I put the toolbar at the top? I want to be able to add bar button items in the same way as my non-table detail views. Thanks. 回答1: My frustration with this problem lay in trying to use the UITableViewController class, which does not allow you to add other UI elements like a toolbar. I solved it by creating a UIViewController object and adding the toolbar and table view to its nib individually. I then had the

UITableView reloadData taking too much time

风流意气都作罢 提交于 2020-01-13 06:09:34
问题 I'm using TBXML+HTTP to get XML data from a website. What I want to do is populate a UITableView with the processed data. I've created a NSMutableArray that holds all the entries and, as far as that goes, everything is working fine. The problem is when, after successfully fetching the data from the server and storing it in the array, I try to update the table to show the data, using reloadData . It takes about 5 seconds to populate the table with 20 rows. The weird part is that the fetching