[go: up one dir, main page]

Skip to content

jzeferino/Xamarin.iOS.FluentAutoLayoutExtensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status NuGet

Xamarin.iOS.FluentAutoLayoutExtensions is a set of extension methods that will help you write Auto Layout constraints with a lot of ease and speed.

The main goal of this project is to have basic building blocks that will help write less Auto Layout constraint code in a fluent way.

Usage examples

  • Centering a view in the screen:
var centeredView = new UIView { BackgroundColor = UIColor.Blue }.EnableAutoLayout();

View.AddSubview(centeredView);

centeredView.WithSize(200, 200);
centeredView.WithSameCenterX(View);
centeredView.WithSameCenterY(View);

  • Align view in bottom with relative size:
var relativeSizeView = new UIView { BackgroundColor = UIColor.Orange }.EnableAutoLayout();
View.AddSubview(relativeSizeView);

relativeSizeView.WithRelativeWidth(View, 0.5f);
relativeSizeView.WithRelativeHeight(View, 0.5f);
relativeSizeView.WithSameBottom(View);

  • Align view to right of another view:
var relativeSizeView = new UIView { BackgroundColor = UIColor.Orange }.EnableAutoLayout();
var relativePositionView = new UIView { BackgroundColor = UIColor.Purple.ColorWithAlpha(0.3f) }.EnableAutoLayout();

View.AddSubview(relativeSizeView);
View.AddSubview(relativePositionView);

relativeSizeView.WithRelativeWidth(View, 0.5f);
relativeSizeView.WithRelativeHeight(View, 0.5f);
relativeSizeView.WithSameBottom(View);
relativeSizeView.WithSameLeading(View);

relativePositionView.ToRightOf(relativeSizeView);
relativePositionView.WithSameBottom(relativeSizeView);
relativePositionView.WithSize(100, 200);

Documentation

  • You can take a look at the full documentation here.

About

Xamarin.iOS Fluent Auto Layout Extensions

Resources

License

Stars

Watchers

Forks

Packages

No packages published