This repository has been archived by the owner on Aug 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Spinner
imchristian_g edited this page Mar 20, 2018
·
1 revision
Para agregar un spinner por xib, seguir los siguientes pasos:
- Agregar una vista al xib
- Ponerle como custom class la clase MLSpinner
//crear el spinner
MLSpinner *spinner = [[MLSpinner alloc]initWithStyle:MLSpinnerStyleWhiteBig text:@"text"];
//agregarlo a la vista padre
[self addSubview:spinner];
//agregarle constraints
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[smallSpinner]-0-|" options:0 metrics:nil views:@{@"smallSpinner" : self.smallSpinner}]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[smallSpinner]-0-|" options:0 metrics:nil views:@{@"smallSpinner" : self.smallSpinner}]];
//mostrarlo animado
[spinner showSpinner];
//setearle el estilo
[spinner setStyle:MLSpinnerStyleWhiteBig];
//setearle el texto
[spinner setText:@"text"];
//mostrarlo animado
[spiner showSpinner];
Para crealo usando Autolayout, inicializar el spinner con alguno de los siguientes métodos:
[[MLSpinner alloc] initWithStyle: MLSpinnerStyle];
[[MLSpinner alloc] initWithStyle: MLSpinnerStyle text:text];
y luego aplicarle las constraints.
Existen distintos estilos predefinidos para el spinner. Para setearle los estilos a los botones, se puede crearlos con su estilo o setearle el estilo luego de crearlos.
Es el estilo por defecto. Acepta texto (como máximo dos líneas). El color del spinner pasa de azul a amarillo.
- Sin texto
- Con texto
Acepta texto (como máximo dos líneas). El color del spinner pasa de azul a blanco.
- Sin texto
- Con texto
No acepta texto. Por más que se le setee texto, el mismo será ignorado.
No acepta texto. Por más que se le setee texto, el mismo será ignorado.