[MonoTouch] UITableViews made simple

bryan costanich b at wowzer.net
Sat Nov 14 02:02:34 EST 2009


Miguel, you mean like in iphone settings?

-b

On Nov 13, 2009, at 11:00 PM, "Brent Schooley"  
<schooleybrent at gmail.com> wrote:

> Maybe it's just the fact that it's late, but I'm not sure I got what
> the point of this thing was.  That being said, I prefer the look of
> style 2.
>
> Can you explain this again?
>
> -Brent
>
> On Nov 14, 2009, at 1:28 AM, Miguel de Icaza <miguel at novell.com>  
> wrote:
>
>> Hey folks,
>>
>>   I have been thinking about writing a control that would simplify
>> making configuration-like UITableView, and I am struggling between  
>> the
>> Mono.Options-like model for creating the data to be debugged and a
>> setup
>> with classes and attributes.
>>
>>   For example, this is what the code would look like using classes
>> and
>> attributes, it would use Reflection over public field names to  
>> extract
>> default captions and attributes to spice up the UI (icons,  
>> separators,
>> parameters).
>>
>>   Another option would be to build it like Mono.Options, where the UI
>> is constructed one item at a time and would be trivial to add event
>> handlers that respond on changes (with delegates):
>>
>> Style 1:
>>
>> class SoundConfig : Configurable {
>>   [Icon ("airplane.png")]
>>   public bool AirplaneMode;
>>
>>   [Text ("Wi-Fi"), Icon ("wifi.png")]
>>   public Configurable WiFi;
>>
>>   [Icon ("Notifications")]
>>   public Configurable Notifications;
>>
>>   [Icon ("Silent.png")]
>>   public Separator Silent;
>>   public bool Vibrate;
>>
>>   [Icon ("Ring")]
>>   public Separator Ring;
>>   public bool on;
>>
>>   [Slider ("mute.png", "full-volume.png")]
>>   public float value;
>> }
>>
>> UIViewController Do ()
>> {
>>   var s = new SoundConfig () {
>>       AirplaneMode = true,
>>       WiFi = ...;
>>       Notifications = ...;
>>       Vibrate = true;
>>       on = false;
>>       value = -0.5;
>>   }
>>   return new ReflectionViewController (s);
>> }
>>
>>
>> Style 2:
>> class Demo {
>>   static bool airplane;
>>   static string wi_fi;
>>
>>   void Setup ()
>>   {
>>
>>       var settings = new SettingsViewController (){
>>           { airplane_icon, airplane, "Airplane Mode", v => airplane
>> = v },
>>           { wifi_icon, wi_fi, "Wi-Fi", r => return r.ToString () }
>>       };
>>
>>
>>   }
>>
>> }
>>
>> _______________________________________________
>> MonoTouch mailing list
>> MonoTouch at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/monotouch
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch


More information about the MonoTouch mailing list