Creo un botón mediante programación ..........
button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(aMethod:)
forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[view addSubview:button];
¿Cómo puedo cambiar el color del título?
ios
objective-c
iphone
uibutton
Hola Mundo
fuente
fuente

btn.titleColor, solo estábtn setTitleColordisponibleUsted creó el,
UIButtonse agregaViewController, El siguiente método de instancia para cambiarUIFont,tintColoryTextColordelUIButtonC objetivo
Rápido
Swift3
fuente
Solución en Swift 3 :
Esto establecerá el color del título del botón.
fuente
Con Swift 5,
UIButtontiene unsetTitleColor(_:for:)método.setTitleColor(_:for:)tiene la siguiente declaración:El siguiente código de muestra de Playground muestra cómo crear un
UIbuttonen ayUIViewControllercambiar su color de título usandosetTitleColor(_:for:):fuente
Si está utilizando Swift, esto hará lo mismo:
buttonName.setTitleColor(UIColor.blackColor(), forState: .Normal)¡Espero que ayude!
fuente