Vorrei fare l'UISlider personalizzato, qualcosa di simileCome modificare le dimensioni dell'immagine pollice della UISlider di programmazione
| o ---------- | -> | ----- O ------ | -> | ------------ 〇 |
il thumbImage
sarà piccolo al valore minimo, aumenterà la dimensione durante l'aumento del valore del cursore, altrimenti diminuirà.
qualcuno sa come farlo?
thx per la risposta, ho aggiunto con il seguito, ho ragione? Ma provo con problemi con le dimensioni dell'immagine ... rapporto float = penSize_sld.value/(penSize_sld.maximumValue/2); CGSize ss = CGSizeMake (penSize_sld.currentThumbImage.size.width * ratio, penSize_sld.currentThumbImage.size.height * ratio); UIImage * changeImage = [UIImage imageWithImage: penSize_sld.currentThumbImage ridimensionatoToSize: ss]; [penSize_sld setThumbImage: changeImage forState: UIControlStateNormal]; if (mittente == penSize_sld) { brushWidth = penSize_sld.value; } – AndyYeung
Se hai bisogno di aggiungere ulteriori informazioni, modifica il tuo post e metti il codice lì ... – Peres
Questo lavoro! Grazie JackyBoy 'float ratio = penSize_sld.value/(penSize_sld.maximumValue/2); if (rapporto <0,8) { rapporto = 0,8; } UIImage * thumbImage = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource: @ "drawview_dragbar_bu_1.png" ofType: nil]]; CGSize ss = CGSizeMake (thumbImage.size.width * ratio, thumbImage.size.height * ratio); UIImage * changeImage = [UIImage imageWithImage: thumbImage scaledToSize: ss]; [penSize_sld setThumbImage: changeImage forState: UIControlStateNormal]; ..... } ' – AndyYeung