Tocropviewcontroller: Bildquadrat zuschneiden

Erstellt am 6. Feb. 2019  ·  3Kommentare  ·  Quelle: TimOliver/TOCropViewController

  1. Wählen Sie ein quadratisches Bild aus und legen Sie es mit setAspectRatioPreset as square auf CropViewController fest.
  2. Ich wähle ein quadratisches Seitenverhältnis über die Seitenverhältnis-Schaltfläche.
    3. Der erzeugte Rahmen ist nicht wirklich quadratisch.
    Kann ich dafür eine Lösung haben...?
bug pr requested

Hilfreichster Kommentar

Ich verwende diesen Code. Ich wollte, dass das beschnittene Bild nur quadratisch ist und es einwandfrei funktioniert.

cropVC = TOCropViewController.init(Bild: Bild)
cropVC.delegate = self
cropVC.setAspectRatioPresent(.presetSquare, animiert: true)
cropVC.aspectRatioLockEnabled = true
present(AccountSettingsVC.cropVC, animiert: true, Vervollständigung: nil

Danke Tim Oliver. Sparen Sie mir viel Entwicklungszeit.

Alle 3 Kommentare

Hi!

Klingt nach einem Bug! Bitte hängen Sie das Bild an und fügen Sie den Code ein, den Sie zur Darstellung des Ansichtscontrollers verwendet haben.

Ich habe gerade keine Zeit, das zu pflegen. Alle PRs sind willkommen. :D

func CropViewController(imagePosted: UIImage) {
let image: UIImage = imagePosted
let cropViewController = CropViewController(Bild: Bild)
cropViewController.delegate = self
cropViewController.setAspectRatioPreset(.presetSquare, animiert: true)
self.navigationController?.pushViewController(cropViewController, animiert: false)
}

Das Bild, das ich ausgewählt hatte, ist wie folgt:
1474177280368

Ich verwende diesen Code. Ich wollte, dass das beschnittene Bild nur quadratisch ist und es einwandfrei funktioniert.

cropVC = TOCropViewController.init(Bild: Bild)
cropVC.delegate = self
cropVC.setAspectRatioPresent(.presetSquare, animiert: true)
cropVC.aspectRatioLockEnabled = true
present(AccountSettingsVC.cropVC, animiert: true, Vervollständigung: nil

Danke Tim Oliver. Sparen Sie mir viel Entwicklungszeit.

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen