Glass button for iPhone

Since iOS does not provide a default glossy button implementation I wrote my own, based mostly on looking at a screenshot of Apple's own.

Some folks have been using the UIGlassButton generator, but I have wanted for a while to have this functionality avaialble at runtime, and not depend on pre-generated images, these are created at runtime, and behave just like a regular button:

You can find my implementation as part of MonoTouch.Dialog on github.

This is how you would use it, and how you can customize some of its elements:

	var b = new GlassButton (bounds) {
		Font = UIFont.BoldSystemFontOfSize (22),
		NormalColor = UIColor.Green,
		HighlightedColor = UIColor.Red
	};
	b.SetTitle ("Dismiss", UIControlState.Normal);

	container.AddSubview (b);
	
Posted on 08 Apr 2011 by Miguel de Icaza

MonoTouch 4.0

We just released MonoTouch 4.0, a product to build iOS applications using C# and .NET. We also released our new Mono for Android product.

New in MonoTouch 4.0

MonoTouch 4.0 is a major upgrade to our product as it upgrades the Mono runtime engine from the old, trusted and friendly Mono 2.6 to the latest and greatest Mono 2.10 core, these are some of the new features available as part of this upgrade:

  • Parallel Frameworks for C#: Great APIs for building multi-threaded software. Not only this is great for iPad 2 users and developers, but it also simplifies just plain multi-threaded programming by exposing Futures, Tasks and Parallel LINQ to the developer.
  • LLVM Compiler Support: In addition to the fast Mono compilation engine, MonoTouch can now also use LLVM to create optimized builds. When you build MonoTouch applications using LLVM your executables will run faster, they will be smaller, and you can optionally opt into generating the nimbler ARMv7 or Thumb code (fat binaries are also supported).

    Example: My own TweetStation distribution went from 8 megs to 6 megs using Thumb + ARMv7 support. A very significant gain.

  • C# 4.0 and .NET 4.0: This release comes with the latest incarnation of the C# language as well as exposing the new .NET 4.0 APIs (many new functional constructs make for nicer looking code, like all the IEnumerable enabled-methods in System.IO).

    There is one important limitation: C# 4.0 dynamic support is not functional, since it requires dynamic code generation to work.

  • Upgraded WCF stack: We still consider this a preview of the full WCF but has been expanded significantly.
  • All new iOS 4.3 APIs have been exposed.
  • NSDecimal, NSDecimalNumber are now exposed (mostly for the sake of CorePlot :-)
  • Many new convenience APIs have been introduced.

For a full detailed list of changes, see our MonoTouch 4.0 Release Notes.

Resources

The best source of information on parallel programming with Parallel FX is the free Patterns for Parallel Programming: Understanding and Applying Parallel Patterns with the .NET Framework 4.

This is a brilliant document. Whether you use .NET or not, this is a recommended reading for everyone.

In addition to the Programming iPhone with MonoTouch book there are two new books about to hit the shelves Developing C# Apps for iPhone and iPad using MonoTouch: iOS Apps Development for .NET Developers: an incredibly in-depth book from Brian Costanich that I have had the privilege to read in advance. This book will come out in only 3 weeks.

If you are more of a hands-on kind of guy, later in the year, Mike Bluestein's Learning MonoTouch: A Hands-On Guide to Building iPhone and iPad Applications with C# and .NET is coming out.

Next Steps

We are currently hard at work to add support to MonoDevelop to work with the new XCode 4.

With XCode 4, Apple removed Interface Builder as a standalone tool. We should have a beta in a couple of weeks of the solution we came up with.

Posted on 06 Apr 2011 by Miguel de Icaza
This is a personal web page. Things said here do not represent the position of my employer.