¿Cómo puedo conectar el método de cambio de valor de mi UISegmentedControl programmatically. Sé que es posible usar IB, pero me preguntaba cómo hacerlo con el código. Gracias.UISegmentedControl value changed programmatically
6
A
Respuesta
17
Adjunte target-action para el evento de control UIControlEventValueChanged
.
Ejemplo
[segmentedControl addTarget:self action:@selector(valueChanged:) forControlEvents: UIControlEventValueChanged];
4
Puede utilizar el addTarget: Método: forControlEvents de acción.
UISegmentControl *mySegmentedControl = [UISegmentControl ...];
[mySegmentedControl addTarget:self action:@selector(segmentValueChanged:) forControlEvents:UIControlEventValueChanged];
Cuestiones relacionadas
- 1. UISegmentedControl text programmatically
- 2. change NSSlider Value programmatically
- 3. Rails 3 has_many changed?
- 4. Eclipse Indigo Font Changed
- 5. WPF Stop Storyboard on Visibility Changed
- 6. UISegmentedControl Dentro de UIToolBar
- 7. Usando UISegmentedControl como botón
- 8. UISegmentedControl escala de imagen
- 9. UISegmentedControl, UIToolbar y UINavigationItem
- 10. UISegmentedControl Best Practice
- 11. UISegmentedControl y agregar objetivos
- 12. CMake copy if original file changed
- 13. Rails 3.1 Not Reloading Changed Views
- 14. Creando logger logger programmatically
- 15. Cómo enviar más argumentos en C# backgroundworker progressed changed event
- 16. ComboBox ItemsSource changed => SelectedItem está en ruinas
- 17. UISegmentedControl Color en una UIToolbar
- 18. UITableViewCell/UISegmentedControl límite de problema
- 19. ¿Cómo puedo desactivar un UISegmentedControl?
- 20. UISegmentedControl con número de placa
- 21. ¿Cómo personalizar UISegmentedControl en iOS?
- 22. Compruebe httpErrors errorMode programmatically
- 23. C# JSON Serialización del diccionario en {key: value, ...} en lugar de {key: key, value: value, ...}
- 24. C# create report programmatically
- 25. Android install apk programmatically
- 26. Establecer NSWindow Size programmatically
- 27. configurar un RadioGroup programmatically
- 28. Android Button Position Programmatically
- 29. Restablecer UISearchbar programmatically
- 30. Establecer título UITabBarItem programmatically?