In Xcode Storyboard, come si crea un pulsante iOS con angoli arrotondati?

Non potete crearlo direttamente con gli angoli arrotondati (voglio dire, non potete vederlo durante la fase di storyboarding). Fondamentalmente aggiungi il tuo UIButton alla tua UIView. Poi avete 2 modi :

  1. Creare un IBOutlet e applicare l'arrotondamento via codice
  2. Applicare l'arrotondamento direttamente in Interface Builder con attributi runtime definiti dall'utente

Creare IBOutlet

Presumo che abbiate già nozioni base di sviluppo iOS. Create un IBOutlet nel vostro UIViewController e collegatelo all'UIButton. Then, if you’re developing with Swift, you can add a didSet closure to your outlet adding this line :

  1. myButton.layer.cornerRadius = 4 

If you’re using Objective-C, you can write this line in the viewDidLoad method.

Apply roundering via Interface Builder

Select your UIButton and go to the Identity Inspector (3rd tab on the right panel). Sotto "User Defined Runtime Attributes" scrivi "layer.cornerRadius" per la colonna del percorso chiave, seleziona "Number" come tipo e scrivi 4 (o qualsiasi numero tu voglia) nel valore.