0

I can't find any reasons for this behavior.

Here's a screenshot of my environment

I try to use the slider on my iPhone testing device but it doesn't respond to my gestures. Also, the track is missing.

What else do I need to provide for someone to help me.

Here's the code of my view controller:

import UIKit

class SettingTableViewController: UITableViewController {
/*
 @IBOutlet weak var switchInvertColors: UISwitch!
 @IBOutlet weak var switchDisableVibrations: UISwitch!
 @IBOutlet weak var switchAutoSaveOnHome: UISwitch!
 @IBOutlet weak var switchButtonOverlays: UISwitch!
 @IBOutlet weak var switchButtonLock: UISwitch!
 @IBOutlet weak var switchDrawingAlwaysVisible: UISwitch!
 @IBOutlet weak var switchEnableAutoSave: UISwitch!
 @IBOutlet weak var switchIncognitoMode: UISwitch!
 @IBOutlet weak var switchShowTemplate: UISwitch!
 @IBOutlet weak var switchHideConnectionStatusDot: UISwitch!
 */

    @IBOutlet weak var switchInvertColors: UISwitch!
    @IBOutlet weak var switchDisableVibrations: UISwitch!


    @IBOutlet weak var switchAutoSaveOnHome: UISwitch!

    @IBOutlet weak var switchButtonOverlays: UISwitch!
    @IBOutlet weak var switchButtonLock: UISwitch!

    @IBOutlet weak var switchDrawingAlwaysVisible: UISwitch!


    @IBOutlet weak var lineWidth: UISlider!


    @IBOutlet weak var switchEnableAutoSave: UISwitch!
    @IBOutlet weak var switchIncognitoMode: UISwitch!

    @IBOutlet weak var switchShowTemplate: UISwitch!

    @IBOutlet weak var switchHideConnectionStatusDot: UISwitch!


    override func viewDidLoad() {
        super.viewDidLoad()





        // Uncomment the following line to preserve selection between presentations
        // self.clearsSelectionOnViewWillAppear = false

        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem
    }

    // MARK: - Table view data source

    @IBAction func lineWidthChanged(_ sender: UISlider) {
        UserDefaults.standard.set(sender.value, forKey: "lineWidth")

    }
    @IBAction func back(_ sender: UIBarButtonItem) {

        performSegue(withIdentifier: "settingstomain", sender: nil)
    }





    override func viewDidAppear(_ animated: Bool) {


     self.navigationController?.setNavigationBarHidden(false, animated: animated)
        switchInvertColors.isOn = UserDefaults.standard.bool(forKey: "InvertColors")
        switchDisableVibrations.isOn = UserDefaults.standard.bool(forKey: "DisableVibrations")
        switchAutoSaveOnHome.isOn = UserDefaults.standard.bool(forKey: "AutoSaveOnHome")
        switchButtonLock.isOn = UserDefaults.standard.bool(forKey: "ButtonLock")
        switchButtonOverlays.isOn = UserDefaults.standard.bool(forKey: "HideButtonOverlays")
        switchDrawingAlwaysVisible.isOn = UserDefaults.standard.bool(forKey:"DrawingAlwaysVisible")
        switchEnableAutoSave.isOn = UserDefaults.standard.bool(forKey:"AutoSave")
        switchIncognitoMode.isOn = UserDefaults.standard.bool(forKey:"IncognitoMode")
        switchShowTemplate.isOn = UserDefaults.standard.bool(forKey:"ShowTemplate")
        switchHideConnectionStatusDot.isOn = UserDefaults.standard.bool(forKey: "ConnectionStatus")
     //   lineWidth.setValue(UserDefaults.standard.float(forKey:"lineWidth"), animated: true)

    }
    @IBAction func invertColors(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "InvertColors")
    }

    @IBAction func disableVibrations(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "DisableVibrations")
    }

    @IBAction func autoSaveOnHome(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "AutoSaveOnHome")
    }

    @IBAction func buttonLock(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "ButtonLock")
    }


    @IBAction func hideButtonOverlays(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "HideButtonOverlays")
    }


    @IBAction func drawingAlwaysVisile(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "DrawingAlwaysVisible")
    }

    @IBAction func autoSave(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "AutoSave")
    }

    @IBAction func incognitoMode(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "IncognitoMode")
    }

    @IBAction func showTemplate(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "ShowTemplate")
    }


    @IBAction func connectionStatusDot(_ sender: UISwitch) {
        UserDefaults.standard.set(sender.isOn, forKey: "ConnectionStatusDot")
    }

    /*
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)

        // Configure the cell...

        return cell
    }
    */

    /*
    // Override to support conditional editing of the table view.
    override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
        // Return false if you do not want the specified item to be editable.
        return true
    }
    */

    /*
    // Override to support editing the table view.
    override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
        if editingStyle == .delete {
            // Delete the row from the data source
            tableView.deleteRows(at: [indexPath], with: .fade)
        } else if editingStyle == .insert {
            // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
        }    
    }
    */

    /*
    // Override to support rearranging the table view.
    override func tableView(_ tableView: UITableView, moveRowAt fromIndexPath: IndexPath, to: IndexPath) {

    }
    */

    /*
    // Override to support conditional rearranging of the table view.
    override func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool {
        // Return false if you do not want the item to be re-orderable.
        return true
    }
    */

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}

Perhaps I made some sort of mistake in the code, but as far as I can see I did not.

Here is a screenshot of my UISlider in a table cell

I fixed the situation: it had to do with the constraint and height of the cell.

David
  • 31
  • 7

0 Answers0