estoy recibiendo una advertencia del método en desuso cuando se utilizaDesaprobados setLineBreakMode Advertencia
[buttonLeft setLineBreakMode:UILineBreakModeWordWrap];
¿Hay algún otro sustituto de este método?
estoy recibiendo una advertencia del método en desuso cuando se utilizaDesaprobados setLineBreakMode Advertencia
[buttonLeft setLineBreakMode:UILineBreakModeWordWrap];
¿Hay algún otro sustituto de este método?
tratar
[buttonLeft.titleLabel setLineBreakMode:NSLineBreakByWordWrapping];
pueden intentar lo siguiente. es un poco largo, pero creo que funcionará:
// solo queremos agregar nuestra etiqueta personalizada una vez; solo el 1.er paso devolverá nil UILabel titleLabel = (UILabel) [self viewWithTag: TITLE_LABEL_TAG];
if (!titleLabel)
{
// no custom label found (1st pass), we will be creating & adding it as subview
titleLabel = [[UILabel alloc] initWithFrame:titleRect];
[titleLabel setTag:TITLE_LABEL_TAG];
// make it multi-line
[titleLabel setNumberOfLines:0];
[titleLabel setLineBreakMode:UILineBreakModeWordWrap];
// title appearance setup; be at will to modify
[titleLabel setBackgroundColor:[UIColor clearColor]];
[titleLabel setFont:[self font]];
[titleLabel setShadowOffset:CGSizeMake(0, 1)];
[titleLabel setTextAlignment:UITextAlignmentCenter];
[self addSubview:titleLabel];
[titleLabel release];
}
// finally, put our label in original title view's state
[titleLabel setText:title];
[titleLabel setTextColor:titleColor];
[titleLabel setShadowColor:titleShadowColor];
// and return empty rect so that the original title view is hidden
return CGRectZero;
}
UIButton ya tiene TitleLabel personalizable dentro, así que no es necesario crear otro – Vladimir
Para UILabel
, la constante apropiada es ahora NSLineBreakByWordWrapping
(en lugar de UILineBreakModeWordWrap
):
titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
Sólo retirar y reemplazar estas enumeraciones.
En los Previos de iOS6 fue: -
De IOS 6 que es: -
wow que funcionó ... muchas gracias por la respuesta .... !! .. :) – devsri