Autor-Archiv Tobias Stephan

VonTobias Stephan

webkit disable scrolling in swift

Als u niet wilt dat de webview scrolbaar is, kunt u deze eenvoudig uitschakelen met de volgende regels code.

webKitView1.scrollView.isScrollEnabled = false

      
webKitView1.scrollView.panGestureRecognizer.isEnabled = false

webKitView1.scrollView.bounces = false
VonTobias Stephan

webkit disable scrolling in swift

If you do not want the webview to be scrollable, you can easily disable it with the following lines of code.

webKitView1.
scrollView
.
isScrollEnabled = 
false

      
webKitView1.scrollView
.panGestureRecognizer.
isEnabled=
false

webKitView1
.
scrollView
.bounces = false
VonTobias Stephan

iPhone app for the Dremel 3d45 and 3D40 Idea Builder 3d printer software

With this app you can watch up to 3 Dremel 3D45 printers creating your 3D objects..With this app you can monitor up to 3 Dremel 3D45 or 3D40 Idea Builder 3D printers. As you know, the Dremel 3D45 has a camera, unlike the Dremel 3D40 Idea Builder. With this app for the mentioned Dremel 3d printers, you can monitor the status of both device types.With this app you can watch up to 3 Dremel 3D45 printers creating your 3D objects..

New version 1.15 from 02. May 2020
The app for the Dremel printers is now completely translated into 5 languages. Also the feedbacks delivered by the printer have been translated. The app is available in English, German, French and Italian.

Donwload im Apple App Store

New version 1.14 dated April 23, 2020
After updating to IOS version 13.4.1, this caused the app to crash for some users. The problem is solved with this version.

With this app you can watch up to 3 Dremel 3D45 printers creating your 3D objects. Furthermore, there are detailed status messages, such as a time calculation until the object is finished or a possibility to cancel a print. This is especially useful if you want to check at a glance if everything is ok during the printing process. The advantage is that you can intervene in time to bring the object into the world in perfect shape. Simply enter the internal IP address of the device under the settings and you are ready to go. Using the settings of your Dremel 3D45 / 3D40 you can set a local IP address or use the automatically assigned V4 IP address for this. The IP address of your Dremel 3D45 can be found in the settings. The status display contains information about progress, nozzle temperature, time, open or closed doors, platform temperature, chamber temperature, print file name and file type.

Current status information such as expected completion time of the object as well as a progress indicator in percent or the current nozzle temperature. Is the door or lid closed? The app displays it. Temperature of the chamber or platform, with this app you are up to date. You can now use the Cancel button to cancel a print directly from the app.

The app for the Dremel 3D45 – status and control of your 3D printer!

VonTobias Stephan

Swift 5 Timer Event Beispiel Sample

Dieses Timer Event Beispiel kannst Du einfach in die viewDidLoad() Methode packen.

Im Ausgabe Fenster kannst du verfolgenden, wie das Ereignet alle 5 Sekunden „gefeuert“ wird.

let timer = Timer.scheduledTimer(withTimeInterval: 5.0, repeats: true) { timer in
print("Timer fired!")

}
let df = DateFormatter()
df.dateFormat = "yyyy-MM-dd hh:mm:ss"
let sDate = df.string(from: timer.fireDate)
print(sDate)
VonTobias Stephan

Navigation Controller Swift Back Button

Zu diesem Titel findet man zahlreiche Beiträge. In diesem Beispiel soll von dem Button „Geschwindigkeit lernen“ der nächste ViewController aufgerufen werden. Der Zurück-Button ist hier total wichtig…denn sonst gibt es keinen Weg zurück

dasdf

Das Segue hab ich einfach mit Rechts-Click auf den Button erstellt.

 

 

 

 

VonTobias Stephan

Swift 5.1 JSON to Object auslesen

Hier ein einfaches Beispiel, wie man ein Json String auslesen bzw. parsen kann.

let str = "{\"names\": [\"Bob\", \"Tim\", \"Tina\"]}"
let data = Data(str.utf8)

do {
    // Sicher stellen, dass es sich um das korrekte JSON Format handelt
    if let json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
        // try to read out a string array
        if let names = json["names"] as? [String] {
            print(names)
        }
        for (key, value) in json {
            print("\(key) : \(value)")
        }
    }
} catch let error as NSError {
    print("Failed to load: \(error.localizedDescription)")
}
VonTobias Stephan

Einfache Einmaleins App

Dies Einmaleins App ist wirklich mal einfach. Hier gilt, wenn einfach einfach einfach ist. Übung macht den Meister! Geübt werden kann wahlweise im Zahlenraum von 1 bis 10 oder von 1 bis 100. Diese App ist für Grundschulkinder gedacht. Mit 3 verschiedenen Smileys wird der Leistungsstand angezeigt.

Außerdem wird die Übungszeit in Minuten angezeigt. Die Übungszeit wird jedoch nur mitgezählt, wenn Ihr Kind aktiv mit der App übt. So kann man zur Tagesaufgabe 5 Minuten App üben ansetzen. Das verbessert die Bearbeitungszeit von Aufgaben schon extrem. Spielerisch zum Erfolg!

VonTobias Stephan

Swift 5 App im Hintergrund erkennen (app moved to background)

Mit diesen Codzeilen kann man erkennen, ob eine App in den Hintergund geschoben wird.

 override func viewDidLoad() {
        super.viewDidLoad()

        let notificationCenter = NotificationCenter.default
        notificationCenter.addObserver(self, selector: #selector(appMovedToBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)


    }

    @objc func appMovedToBackground() {
        print ("App moved to Background")
    }

VonTobias Stephan

Swift 5 App im Vorderung erkennen (app moved to foreground)

Manchmal ist es sinnvoll zu erkenne, ob die eigene App in den Vordergrund geschoben wird. Mit diesen paar Codezeilen ist das leicht zu ermitteln.

   override func viewDidLoad() {
        super.viewDidLoad()
        

       

        let notificationCenter = NotificationCenter.default
        notificationCenter.addObserver(self, selector: #selector(appMovedToForeground), name: UIApplication.willEnterForegroundNotification, object: nil)


    }

    @objc func appMovedToForeground() {
        //do stuff
    }

VonTobias Stephan

Swift 5 tap gesture Geste

Diese paar Zeilen Code helfen schnell zu verstehen wie man einem Image die Tap Geste beibringt.

   
override func viewDidLoad() {
        super.viewDidLoad()



        self.imgPlacesPic.isUserInteractionEnabled = true;
        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.tapGesture))
        imgPlacesPic.addGestureRecognizer(tapGesture)
    }

    @objc func tapGesture() {

        performSegue(withIdentifier: "FromMainToImages", sender: self)
    }