uitableview

RxSwift table view with multiple custom cell types

吃可爱长大的小学妹 提交于 2020-06-10 07:28:13
问题 I'w wonder is there any code example for RxSwift when I can use multiple custom cells inside one table view. So for example I have two section and first section has 10 cells with type CellWithImage identifier and second section has 10 cells with type CellWithVideo identifier. All tuts and code examples which I've founded are using only one cell type, for instance RxSwiftTableViewExample Thanks for any help 回答1: I've managed it using RxSwiftDataSources, it allow you to use custom cells with

How can I update the numberOfRowsInSection and how do I show all added values in this tableView?

两盒软妹~` 提交于 2020-06-09 05:24:49
问题 I am trying to send values from one view controller - NewZoomAddressViewController to another one - Add_EditAddressViewController . I am sending the values to an array in the second view controller ( addressArray ). Here is the first view controller: class NewZoomAddressViewController: UIViewController { @IBOutlet weak var mapView: MKMapView! @IBOutlet weak var addressLabel: UILabel! var addressArray = [String]() override func viewDidLoad() { super.viewDidLoad() print("in Zoom map VC")

Minimum cell height with UITableViewAutomaticDimension

青春壹個敷衍的年華 提交于 2020-06-07 09:45:49
问题 Is it possible to set minimal height for cell? I use dynamic: tableView.estimatedRowHeight = 83.0 tableView.rowHeight = UITableViewAutomaticDimension But I need to set minimal height for cell when my news title label text is in one line. 回答1: Have you tried creating a constraint in your custom UITableViewCell 's view of height >= 60.0 ? 回答2: Got it. Made it work as below. Drag and drop a View on top of UITableViewCell and set constraints Leading, trailing, top and Bottom as 0. Set height

How to add Array value to JSON Key in Swift

大兔子大兔子 提交于 2020-06-01 06:22:11
问题 How to add request.httpBody = getPostData(params: ["contactsList": ["1212121212, "5555555544"]]) in place of let parameters = getPostString(params: ["contactsList":[phNumArray]]) below is working code but how to add phNumArray in palce of individual of individual numberes to contactsList Postman output for API: working code: anyone can copy paste to see output import UIKit class TestViewController: UIViewController { var phNumArray = ["1111111111", "5555555544"] override func viewDidLoad() {

How to change table cell height (collapse and expand) according to its content by clicking?

情到浓时终转凉″ 提交于 2020-06-01 05:55:07
问题 Initially the user sees cell like this (Only black area. Description is hidden). That is, a cell is visible up to description. I want after clicking on the cell that its height increase to the end of the cell, like this. Both Title and Description are not static. Their size depends on the content. You can see in this case I always change the height to constant values. It's not good for my requirements. extension MyTableView: UITableViewDataSource, UITableViewDelegate { //another funcs... func

Scale tableView cell with CGAffineTransform to cover entire screen

删除回忆录丶 提交于 2020-06-01 05:14:25
问题 I have a tableView where when a user taps on that cell, I want the cell to expand and fill the entire screen with that color. Currently, it does scale to fill the entire screen but the cells above it will also show. The colors come from an API and each cell changes color when the user taps the "Generate" button. Due to how the API's JSON file is structured, I only want 5 colors on the screen at a time. I can't figure out why the cells above it don't move upwards or how I can move the clicked

Disable multiple taps on uitableviewcell

岁酱吖の 提交于 2020-05-29 06:13:12
问题 I have a uitableview that implements a popover (PopoverView) when a cell is tapped and then the popover will dismiss on any other tap on the screen. The issue is that if a user would to double tap or tap repeatedly on the cell, it will cause multiple instances of popoverviews to display and then the application will crash.. I am looking for a way to either disable double tapping on the cell and/or the UITableView in general OR is there a way to delay touches on a UITableViewCell any ideas? I

Swift 4 tableView API Pagination

隐身守侯 提交于 2020-05-28 07:16:31
问题 I have successfully parsed and decoded the JSON data and it displays in the console. I don't know how I would set up pagination with the api and display all of the data when I scroll down on the tableView. The API I'm using is https://rickandmortyapi.com/api/character/. Thank you for all your help in advance! This is the code in my main ViewController import UIKit struct PagedCharacters: Codable { struct Info: Codable { let count: Int let pages: Int let next: String let prev: String } struct

Swift 4 tableView API Pagination

百般思念 提交于 2020-05-28 07:13:12
问题 I have successfully parsed and decoded the JSON data and it displays in the console. I don't know how I would set up pagination with the api and display all of the data when I scroll down on the tableView. The API I'm using is https://rickandmortyapi.com/api/character/. Thank you for all your help in advance! This is the code in my main ViewController import UIKit struct PagedCharacters: Codable { struct Info: Codable { let count: Int let pages: Int let next: String let prev: String } struct

Set custom font for UITableView swipe action (UIContextualAction)

余生颓废 提交于 2020-05-28 04:42:19
问题 How do you set a custom font for the title in UIContextualAction ? I have tried UIAppearance but without any luck... Cheers! :) 回答1: I have found a way to do this by using the image property instead of the title... Standard font (Remove/Rename) Custom font (Remove/Rename) To create an image of a label I have this extension: extension UIImage { /// This method creates an image of a view convenience init?(view: UIView) { // Based on https://stackoverflow.com/a/41288197/1118398 let renderer =