小编Qui*_*let的帖子

字符串转换为Int并将逗号替换为加号

使用Swift,我试图在应用程序的文本视图中输入一个数字列表,并通过提取成绩计算器的每个数字来创建此列表的总和.此外,用户输入的值的数量也会发生变化.一个例子如下所示:

字符串:98,99,97,96 ...试图得到:98 + 99 + 97 + 96 ......

请帮忙!谢谢

string int swift swift3

28
推荐指数
3
解决办法
8万
查看次数

无限滚动CollectionView以编程方式快速

我想无限地以编程方式快速滚动collectionView中的10张图像。图片是根据我的选择来自json的网络。我一直无法滚动20张图像。这是我的代码

import Foundation


import UIKit

let categoryCellid = "categoryCellid"


class ProductByCategoryCollectionView: UICollectionViewController, UICollectionViewDelegateFlowLayout {

    var headercellId = "headercellId"


    var callCategoryObject = [Product]()


    func getPropductListByCategory(){

        // has api code, that was well
    }




    override func viewDidLoad() {
        super.viewDidLoad()



        self.getPropductListByCategory()


        collectionView?.backgroundColor = .white

        navigationItem.title = "Product"
        navigationItem.backBarButtonItem = UIBarButtonItem(title: "Back", style: .plain, target: nil, action: nil)
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Sort By", style: .plain, target: nil, action: nil)



        self.setupHeaderView()

        collectionView?.register(ProductByCategoryCollectionViewCell.self, forCellWithReuseIdentifier: categoryCellid)
    }



    func showCategoryDetailSegue() {

        let detailcontroller = UIViewController()
        navigationController?.pushViewController(detailcontroller, animated: true) …
Run Code Online (Sandbox Code Playgroud)

scroll infinite ios swift

2
推荐指数
1
解决办法
2238
查看次数

干净代码的“童子军规则”

我正在使用 Asp.net mvc Web 应用程序,但我的朋友说大部分时间使用干净的代码,说童子军规则适用于干净的代码

谁解释一下。最短和最合适的方式

谢谢你

c# asp.net-mvc coding-style

0
推荐指数
1
解决办法
2041
查看次数

以编程方式Swift在视图控制器之间传递数据

我有两个viewcontroller类.MainViewController有一个UITextField,而SecondViewController有一个UILabel.我想从UILabe中的UITextField打印文本.请告诉我以编程方式执行此操作的最佳方法.以下是我的代码:

// AppDelegate.swift

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?


  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Run Code Online (Sandbox Code Playgroud)

window = UIWindow(frame:UIScreen.main.bounds)

window?.makeKeyAndVisible()

window?.rootViewController = MainViewController()

window?.backgroundColor = UIColor.yellow

application.statusBarStyle = .lightContent


return true
  }

 }
Run Code Online (Sandbox Code Playgroud)

// MainViewController类

import UIKit

class MainViewController: UIViewController {


  let label = UILabel()

  let textField = UITextField()



  override func viewDidLoad() {

    super.viewDidLoad()


    view.backgroundColor = UIColor.gray
    setupLabel()
    setupTextField()
    setupButton()
  }

  func setupLabel() {

    label.frame = CGRect(x: 40, y: 80, width: …
Run Code Online (Sandbox Code Playgroud)

ios swift swift3

0
推荐指数
1
解决办法
6959
查看次数

标签 统计

swift ×3

ios ×2

swift3 ×2

asp.net-mvc ×1

c# ×1

coding-style ×1

infinite ×1

int ×1

scroll ×1

string ×1