public static void AddMultilinesLayers(this CALayer This, int lines, SkeletonType type, SkeletonConfig config) { var numberOfSublayers = CalculateNumLines(This, lines, config); var width = This.Bounds.Width; for (var index = 0; index < numberOfSublayers; index++) { if (index == numberOfSublayers - 1 && numberOfSublayers != 1) { width = width * (config.MultilineLastLineFillPercent / 100f); } var layer = SkeletonLayerFactory.MakeMultilineLayer(type, index, width, config); This.AddSublayer(layer); } }
public static void AddSkeletonLayer( this UIView This, UIColor[] colors, SkeletonType type, GradientDirection?direction = null, bool animated = false, SkeletonLayerAnimation animation = null) { var skeletonLayer = SkeletonLayerFactory.MakeLayer(type, colors, This); if (direction.HasValue && animation == null) { animation = direction.Value.SlidingAnimation(); } This.SetSkeletonLayer(skeletonLayer); This.Layer.InsertSublayer(skeletonLayer.ContentLayer, int.MaxValue); if (animated) { skeletonLayer.StartAnimation(animation); } This.SetSkeletonStatus(Views.Status.On); }