Well, the Clicked method (and other events) are just using an internal delegate.

Does it not work at all? or only on the second call?

try taking out the if (sheet == null) bit, and recreate it each time.



On Sun, Jul 1, 2012 at 6:50 PM, Gerry High <[email protected]> wrote:
> I do not recreate it each time as it is stored in a class variable.  So I do 
> a check of
>
> if (sheet == null)
> {
>         create it here
> }
> sheet.Clicked += TakePhoto();
> sheet.ShowInView(this.View);
>
> In my clicked handler I then create the image picker and have tried quite a 
> few variations on PresentModalViewControllerAnimated (this, 
> navigationcontroller, root, etc.) as well as the recommended 
> PresentViewController with a completed handler.
>
> The only way I got it to work was to comment out the Clicked handler and 
> instead set a delegate which implements the Dismissed method (e.g. 
> sheet.Delegate = new MySheetDelegate();)
>
> Thanks,
> Gerry
>
> On Jul 1, 2012, at 12:00 PM, Nic Wise <[email protected]> wrote:
>
>> Could it be that you are not recreating the ActionSheet each time? I
>> have a load of working code around this, eg
>>
>> https://gist.github.com/3028960
>>
>> parentview, in this case, is the dialogviewcontroller that the user
>> was looking at when they hit the button.
>>
>>
>>
>> On Sun, Jul 1, 2012 at 3:03 PM, Gerry High <[email protected]> wrote:
>>> I sent this yesterday to the list but then never saw it posted so am 
>>> resending it.
>>> =====
>>> I noticed an issue in using an UIActionSheet in combination with a 
>>> UIImagePickerController and thought I'd shared what I've seen and a work 
>>> around.  I ported some working code from Xcode to MonoTouch and got a crash 
>>> with "Application tried to present modally an active controller".  The use 
>>> case is a UIActionSheet displaying 2-3 buttons and then from the 
>>> UIActionSheet.Clicked event displaying a UIImagePickerController.
>>>
>>> On the first call from the ActionSheet to the ImagePicker it works fine all 
>>> the way through the cancel from the image picker.  However, the second time 
>>> I make the call it fails when trying to display the UIImagePickerController 
>>> with the above mentioned error.
>>>
>>> One thing I did in comparing my Xcode vs MT code is that I was using the 
>>> Clicked event on the action sheet vs the action sheet delegate method 
>>> didDismissWithButtonIndex.  I decided to write a simple delegate class and 
>>> override the Dismissed method.  Now my code works with no errors.
>>>
>>> Is there a difference in how the delegate Dismissed method works vs the 
>>> Clicked event?  You would think they'd behave the same but it appears that 
>>> they do not.
>>>
>>> Thanks.
>>> Gerry
>>> _______________________________________________
>>> MonoTouch mailing list
>>> [email protected]
>>> http://lists.ximian.com/mailman/listinfo/monotouch
>>
>>
>>
>> --
>> Nic Wise
>> t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
>> b. http://www.fastchicken.co.nz/
>>
>> Earnest: Self-employed? Track your business expenses and income.
>> http://earnestapp.com
>> Nearest Bus: find when the next bus is coming to your stop. 
>> http://goo.gl/Vcz1p
>> mobileAgent (for FreeAgent): get your accounts in your pocket.
>> http://goo.gl/IuBU
>> Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
>> London Bike App: Find the nearest Boris Bike, and get riding! 
>> http://goo.gl/Icp2
>
>



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to