uitableview

swift data not transferred from UIBarButtonItem to another viewcontroller

核能气质少年 提交于 2021-02-17 06:52:27
问题 This is an extension of an earlier question:- ios Swift Items do not get added to cart The original issue is resolved. Now I have a supplementary hitch:- The issue is in CartViewController - When I click on "Checkout(2)" rightBarButtonItem in the ProductViewController, it shows error in CartviewController's "numberOfRowsInSection" function - Kindly see image & codes below:- class ProductViewController - import UIKit class ProductViewController: UIViewController, UITableViewDataSource,

Cannot convert value of type 'Int' to expected argument type 'Dictionary.Index'

跟風遠走 提交于 2021-02-17 05:17:05
问题 i am getting the error "Cannot convert value of type 'Int' to expected argument type 'Dictionary.Index'" at lines 8 & 9 ("let k" & "for y in") var namesDictionary = [String: [classObject]]() func checkFavoriteCount(table:UITableView) { favArray.removeAll() for x in (0...namesDictionary.keys.count - 1) { let k = namesDictionary[x].key for y in (0...namesDictionary[x].value.count - 1) { if (namesDictionary[k]?[y].isFav ?? false) { favArray.append((namesDictionary[k]?[y])!) } } } tableView

Don't delete some rows from UITableView

送分小仙女□ 提交于 2021-02-17 02:40:50
问题 I'm trying to implement the functionality to delete some rows from a table view and not others. In this case, everything in section 0 should not be deletable (so not swipe to delete either), but everything in section 1 should be able to. How can I implement this? Currently section 0 rows cannot delete, but when the user swipes, the delete action still appears. override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {

How to update progressview in uitableview cell by urlsession (download/upload file)

我只是一个虾纸丫 提交于 2021-02-11 16:52:59
问题 In Objective c i wrote download/upload with progressview in uitableviewcell (multiple upload/download) by AFNETWORKING. and work find it's can be update progressview/file/cell. and Now im noob first time change to SWIFT programming and use urlsession. code class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, URLSessionDelegate, URLSessionDataDelegate, URLSessionTaskDelegate { //var dataArr:Dictionary<String,String> = [:] var dataArr : NSMutableArray =

How to update progressview in uitableview cell by urlsession (download/upload file)

自作多情 提交于 2021-02-11 16:51:30
问题 In Objective c i wrote download/upload with progressview in uitableviewcell (multiple upload/download) by AFNETWORKING. and work find it's can be update progressview/file/cell. and Now im noob first time change to SWIFT programming and use urlsession. code class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, URLSessionDelegate, URLSessionDataDelegate, URLSessionTaskDelegate { //var dataArr:Dictionary<String,String> = [:] var dataArr : NSMutableArray =

TableView with inset grouped style: Have rounded corners even with hidden cells

孤者浪人 提交于 2021-02-11 15:40:28
问题 I have a table of the type inset grouped style. Depending on some selections I want to hide some cells by reducing their height to 0. Now is there anyway to still show rounded corners even if the respective cell has height 0? Or how would you do that? I don't want to "delete" the cell, otherwise it is much more complex to keep track of the cells for me. 来源: https://stackoverflow.com/questions/61502471/tableview-with-inset-grouped-style-have-rounded-corners-even-with-hidden-cells

How to constrain static table view controller cells to Safe Area in Swift/iOS

倾然丶 夕夏残阳落幕 提交于 2021-02-11 15:40:26
问题 I have a table view controller with static cells. I’m running on iPhone X and when scrolling, the cells appear to be behind the navigation bar and unsafe area. What is preferred would be a solid orange color in the unsafe area instead of the image presented below. Is this possible? I can’t move to a table view inside of a view controller, which I would then constrain to the safe area, because my cells are static. 回答1: You need to use a Container View , so add a View Controller in your

TableView with inset grouped style: Have rounded corners even with hidden cells

穿精又带淫゛_ 提交于 2021-02-11 15:38:55
问题 I have a table of the type inset grouped style. Depending on some selections I want to hide some cells by reducing their height to 0. Now is there anyway to still show rounded corners even if the respective cell has height 0? Or how would you do that? I don't want to "delete" the cell, otherwise it is much more complex to keep track of the cells for me. 来源: https://stackoverflow.com/questions/61502471/tableview-with-inset-grouped-style-have-rounded-corners-even-with-hidden-cells

Cannot assign value of type 'CLong?' (aka 'Optional<Int>') to type 'String?' [Swift 5]

不问归期 提交于 2021-02-11 14:59:49
问题 Questions : How do I use DateFormatter(Type: CLong) in tableview? Similar questions I looked for How to change JSON string to date format in tableview I looked up questions like these on stackoverflow. However, there was no way to use Type: CLong. Clong is a type I'm new to using, so I don't know what type to use Optional. connection json file struct BoardList: Codable { var b_date: CLong? } TableViewController var boards: [BoardList]? func tableView(_ tableView: UITableView, cellForRowAt

Self-sizing UICollectionView with UITableView with dynamic header as a cell

六眼飞鱼酱① 提交于 2021-02-11 13:07:41
问题 I have a problem with making a self sizing UICollectionView with a cell that contains UITableView with a header that has a label with dynamic height. Can someone point me out to what I need to change in the attached sample project? You can see on the screenshot that the table does not fit the view as the cell's height is currently manually set. import UIKit class ViewController: UIViewController { static let section1 = "section1" static let section2 = "section2" private weak var