uitableview

When is cellForRowAtIndexPath method called?

Deadly 提交于 2020-05-27 05:37:19
问题 When exactly is this method called ? Suppose at a time I have 4 of my tableview cells visible on the screen then for how many cells will this method be called. Also, what if a cell is partially visible, will the method be called for the next cell as well in this case ? P.S. I am not stuck anywhere, so showing some code doesn't make any sense. Its just a fundamental doubt. 回答1: The most simple explanation I can give you is - cellForRowAtIndexPath , will call when a cell is about to be shown in

Creating view-model for each UITableViewCell

帅比萌擦擦* 提交于 2020-05-24 08:05:07
问题 I'm stuck on a design decision with creating view-models for table view's cells. Data for each cell is provided by a data source class (has an array of Contacts ). In MVVM only view-model can talk to model, but it doesn't make sense to put data source in view-model because it would make possible to access data for all cells, also it's wrong to put data source in view controller as it must not have reference to the data. There are some other key moments: Each cell must have it's own instance

Invalid update of a UIDatePicker inside tableView crashing in iOS 13 on rotation

天涯浪子 提交于 2020-05-17 07:06:32
问题 I am adding a UIDatePicker as a table's footer. I have another extension of UITableView which implements traitCollectionDidChange and only does beginUpdates and endUpdates. I am getting the below crash on changing the orientation. *** Assertion failure in -[UIPickerTableView _Bug_Detected_In_Client_Of_UITableView_Invalid_Number_Of_Rows_In_Section:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3901.4.2/UITableView.m:2407 2020-05-12 13:35:28.729340+0530 MyApplication

Swift: dropdown overflow disappears when scrolling down

﹥>﹥吖頭↗ 提交于 2020-05-17 05:00:47
问题 I am working on this project where I am using drop down menus in tableView cells. I am using the following code to make the drop down part overflow the tableView cells bottoms cell.clipsToBounds=false cell.contentView.clipsToBounds=false Everything works fine, but when I scroll down the tableView till the drop down part is not visible anymore, the overflow stops working. You can see the problem in action in the project below https://github.com/Rawchris/Drop-down-overflow2 In the project I

Swift: dropdown overflow disappears when scrolling down

大城市里の小女人 提交于 2020-05-17 05:00:28
问题 I am working on this project where I am using drop down menus in tableView cells. I am using the following code to make the drop down part overflow the tableView cells bottoms cell.clipsToBounds=false cell.contentView.clipsToBounds=false Everything works fine, but when I scroll down the tableView till the drop down part is not visible anymore, the overflow stops working. You can see the problem in action in the project below https://github.com/Rawchris/Drop-down-overflow2 In the project I

Showing / hiding accessibility elements in an overflow menu when opening a custom UITableViewCell

こ雲淡風輕ζ 提交于 2020-05-15 07:01:06
问题 I’m implementing accessibility in a custom UITableViewCell class. I have a fairly simple overflow menu with a couple of buttons inside it, which are hidden until an ellipsis button is pushed that slides open and closes the overflow. In my cell's initialiser I’m setting the accessibilityElementsHidden of my overflowContainer to YES . This seems to work, when scrolling through using VoiceOver, those views are skipped. Then, when opening the cell, in the completion handler of the UIView

UITableView Refresh without scrolling

醉酒当歌 提交于 2020-05-09 20:27:10
问题 I have a _TableView with items , and I want to set automatic refresh,and I don't want it to scroll on refresh , lets say user scrolled 2 pages down , and the refresh trigered -> so I want to put the refreshed content to the top of the table without interupting user's scrolling Assume user was on row 18 and now the _dataSource is refreshed so it fetched lets say 4 items , so I want user to stay on the item he was. What would be the best approach to achieve it ?? 回答1: I am showing if only one

UITableView Refresh without scrolling

别来无恙 提交于 2020-05-09 20:27:10
问题 I have a _TableView with items , and I want to set automatic refresh,and I don't want it to scroll on refresh , lets say user scrolled 2 pages down , and the refresh trigered -> so I want to put the refreshed content to the top of the table without interupting user's scrolling Assume user was on row 18 and now the _dataSource is refreshed so it fetched lets say 4 items , so I want user to stay on the item he was. What would be the best approach to achieve it ?? 回答1: I am showing if only one

Hide UITableview cell

本秂侑毒 提交于 2020-05-09 19:38:16
问题 i'm trying to Hide a cell from a UITableView. just like the delete action do but i just want to hide it to later show it in the same position. i know that UITableViewCell has a property called "Hidden" but when i hide the Cell using this property it hide but no animated and they leave a blank space Example: first cell second cell third cell it's possible that when i hide the second cell, that third cell change position to 2 ? thanks 回答1: One way to effectively "hide" a row with animation and

Firestore- Showing data in Tableview

坚强是说给别人听的谎言 提交于 2020-05-08 06:04:12
问题 I am attempting to show my Firestore data into my Tableview but I can't seem to get it to show up. protocol DocumentSerializeable { init?(dictionary:[String:Any]) } struct Sourse { var name: String var content: String var timeStamp: Date var dictionary: [String: Any] { return [ "name": name, "content": content, "timestamp": timeStamp ] } } extension Sourse : DocumentSerializeable { init?(dictionary: [String : Any]) { guard let name = dictionary["name"] as? String, let content = dictionary[