[MonoTouch] Problem with UISegmentedControl on iPad

Dean Cleaver dean.cleaver at xceptionsoftware.com
Mon Mar 19 22:15:11 UTC 2012


Sebastien,

I just thought about that now as I was driving home. My devices are iOS5.1 - his iPad is older I believe. I'll have to conditionally do something different for each version.

Dino

-----Original Message-----
From: Sebastien Pouliot [mailto:sebastien at xamarin.com] 
Sent: Monday, March 19, 2012 4:37 PM
To: Roy Goode
Cc: Dean Cleaver; monotouch at lists.ximian.com
Subject: Re: [MonoTouch] Problem with UISegmentedControl on iPad

Hey,

Roy, it's a property. See
http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html#//apple_ref/doc/uid/TP30001163-CH17

Dean, what iOS version are you using on your device ? this property is new in 5.0 (and won't work on earlier versions).

Sebastien

On Mon, Mar 19, 2012 at 5:30 PM, Roy Goode <roy at roygoode.com> wrote:
> It looks like a MonoTouch bug to me. The Obj-C selector being sent to 
> the instance is wrong. It should be "apportionsSegmentWidthsByContent" 
> and not "setApportionsSegmentWidthsByContent". 
> http://developer.apple.com/library/ios/#documentation/uikit/reference/
> UISegmentedControl_Class/Reference/UISegmentedControl.html
>
> The property was added in iOS 5.0.
>
>
> On 19 March 2012 16:17, Dean Cleaver 
> <dean.cleaver at xceptionsoftware.com>
> wrote:
>>
>> Am trying to set the UISegmentedControl to 
>> ApportionsSegmentWidthsByContent = true and it crashes on the iPad - 
>> doesn't crash in the simulator (iPhone) nor on my iPhone devices. Any 
>> ideas why the difference?
>>
>> MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.
>>  Name: NSInvalidArgumentException Reason: -[UISegmentedControl
>> setApportionsSegmentWidthsByContent:]: unrecognized selector sent to 
>> instance 0x868fc80
>>  at
>> MonoTouch.UIKit.UISegmentedControl.set_ApportionsSegmentWidthsByConte
>> nt (Boolean value) [0x00000] in <filename unknown>:0
>>  at
>> KleverLogic.FlashValet.iPhone.Valet.Common.ReceiptViewController.View
>> DidLoad
>> () [0x00374] in
>> /xsl-home/kleverlogic/FlashValet/Mobile/iPhone/Valet/Common/ReceiptVi
>> ewController.cs:103
>>
>> _______________________________________________
>> MonoTouch mailing list
>> MonoTouch at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/monotouch
>
>
>
>
> --
>
> Roy
>
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch
>


More information about the MonoTouch mailing list