A lightweight, code-only layout engine for iOS/MonoTouch
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Demo
Doc
XibFree
out
.gitignore
XibFree.sln
readme.md

readme.md

XibFree - A lightweight, code-only layout engine for iOS/MonoTouch

Sorry :( This Project is not longer under development or maintenance. The repo is kept here for posterity only.

XibFree is a simple layout engine for code-only layouts in Xamarin.iOS (aka MonoTouch)

  • Code only layouts - no more Xib files.
  • Leverages C# language features to define layouts in a concise, flexible and powerful way.
  • Supports LinearLayout - the workhorse of automatic layout.
  • Supports FrameLayout - for overlaid views.
  • Deliberately uses Android terminology and concepts make it instantly familiar for cross-platform developers.
  • Extremely light weight, uses UIViews directly without any re-wrapping or property delegation.
  • Easily integrated into any existing MonoTouch project - it's not a framework so you can use it as much or as little as you like!

A Quick Example

The following is a really simple example to show what a typical XibFree layout looks like:

var layout = new LinearLayout(Orientation.Horizontal)
{
	Padding = new UIEdgeInsets(10, 10, 10, 10),
	LayoutParameters = new LayoutParameters()
	{
		Width = AutoSize.FillParent,
		Height = AutoSize.WrapContent,
	},
	SubViews = new View[]
	{
		new NativeView()
		{
			View = new UILabel()
			{
				Text = "Hello World, from XibFree",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
			},
			LayoutParameters = new LayoutParameters()
			{
				Width = AutoSize.FillParent,
				Height = AutoSize.FillParent,
			}
		},
		new NativeView()
		{
			View = new UIImageView()
			{
				Image = UIImage.FromBundle("tts512.png"),
				ContentMode = UIViewContentMode.ScaleAspectFit,
			},
			LayoutParameters = new LayoutParameters()
			{
				Width = 40,
				Height = 40,
			}
		}
	},
};

Which results in this:

Screen Shot 2013-03-31 at 5.52.28 PM.png

Why Code-Only Layout?

Xamarin's Michael James says it pretty concisely on the Xamarin iOS Forum:

... code-only layouts have a number of other advantages. To start with, many properties and behaviors of iOS layout are not exposed in Xcode’s Interface designer. Additionally, keeping layouts in C# also allows for easier management and tracking of UI changes for development teams and makes it easier to merge changes which can be extremely time consuming when developing with xibs.

Guide

Reference

Examples

Download

Source code, including examples:

Compiled DLL:

License

XibFree Copyright 2013 Topten Software

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this product except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.