I still can't seem to figure it out.
My screen [AssessmentAssembly] has a blank UiimageView [SpaceImage].
I have this imagepickerdelegate class that I have written. It has the basic
events like FinishedPickingMedia, Canceled.
Here is the code for my delegate class.
namespace ASTONAPP
{
public class AssemblyImagePickerDelegate:
UIImagePickerControllerDelegate
{
public AssemblyImagePickerDelegate ()
{
}
AssessmentAssembly _sp;
public AssemblyImagePickerDelegate(AssessmentAssembly sp)
{
_sp = sp;
}
public override void Canceled (UIImagePickerController picker)
{
_sp.DismissModalViewControllerAnimated(true);
Console.WriteLine ("Cancelled picking an image");
}
public override void FinishedPickingMedia
(UIImagePickerController picker,
NSDictionary info)
{
var originalImage = new
NSString("UIImagePickerControllerOriginalImage");
UIImage image = (UIImage) info[originalImage];
image.SaveToPhotosAlbum(delegate(UIImage img, NSError
err){
Console.WriteLine("Saved!");
});
UIImageView imageView = new UIImageView(new
RectangleF(0f, 0f, 450f,
580f));
imageView.Image = image;
_sp.View.AddSubview(imageView);
_sp.DismissModalViewControllerAnimated(true);
Console.WriteLine ("Did finish picking media");
}
}
}
This is what I am doing to open the popup imagegallery.
partial void BrowseAssemblyPhotoClick (MonoTouch.UIKit.UIButton sender)
{
if(popover==null||popover.ContentViewController==null)
{
imagepicker=new UIImagePickerController();
popover=new UIPopoverController(imagepicker);
AssemblyImagePickerDelegate imgDel=new
AssemblyImagePickerDelegate();
imagepicker.Delegate=imgDel;
imagepicker.SourceType=UIImagePickerControllerSourceType.PhotoLibrary;
}
if(popover.PopoverVisible)
{
popover.Dismiss (true);
imagepicker.Dispose ();
popover.Dispose ();
return;
}
else
{
popover.PresentFromRect(btnBrowseAssemblyPhoto.Frame, this.View,
UIPopoverArrowDirection.Any, true);
}
}
I simply can't get my head around how to assign the picked image {if I'm not
wrong that's the info[originalimage]} to be set as the image for my blank
SpaceImage control.
What exactly is the trick? Sorry I'm kind of brickheaded.
Look forward to some help on this.
Many Thanks.
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Take-Pictures-with-IPHone-Camera-tp4656124p4656298.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch