Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ViewController.swift
- // SO
- //
- // Created by Len on 7/24/17.
- // Copyright © 2017 24coms. All rights reserved.
- //
- import UIKit
- class ViewController: UITableViewController {
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view, typically from a nib.
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
- override func numberOfSections(in tableView: UITableView) -> Int {
- return 2
- }
- override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return 10
- }
- override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = UITableViewCell(style: .default, reuseIdentifier: "cell")
- cell.textLabel?.text = "hi"
- return cell
- }
- override func tableView(_ tableView: UITableView, editActionsForRowAt: IndexPath) -> [UITableViewRowAction]? {
- let onay = UITableViewRowAction(style: .normal, title: "Onay") { action, index in
- // these are my functions. but they don't work here.
- self.getOnay(id: 1, status: "ok")
- self.loadOnaylar(userID: 22, code: 11)
- }
- onay.backgroundColor = .green
- let ret = UITableViewRowAction(style: .normal, title: "Ret") { action, index in
- self.getOnay(id: 1, status: "cancel")
- self.loadOnaylar(userID: 22, code: 33)
- }
- ret.backgroundColor = .red
- return [ret, onay]
- }
- override func tableView (_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
- return true
- }
- override func tableView (_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
- print("editingStyle >> \(editingStyle)")
- }
- func getOnay(id:Int, status:String) {
- print("getOnay >> \(id), \(status)")
- }
- func loadOnaylar(userID:Int, code:Int) {
- print("loadOnaylar >> \(userID), \(code)")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement