you could pass the view controller into the delegate (or if you need to reuse it, make it use an interface and implement that interface in your viewcontroller). When you create the delegate, pass the VC you want to use in.
Then you can just call the viewcontroller (or whatever it is you passed in) and pass the image in. After that, you are in the context of your VC. On Tue, Jul 31, 2012 at 5:24 AM, proindigo <[email protected]> wrote: > I finally got my code working. A popup is being opened when I click the > button presenting the collection of images from the photogallery. > > Now I want that when user selects a particular image that image should be > set as the image for a imageview control on the parent screen. Obviously we > should write the code in the FinishedPickingMedia event of the > imagepickerdelegate class. But how am I going to access a control on a view > controller from a class file? That is the question. Can you please help me > with this? > > > Here is the code flor 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"); > } > } > } > where AssessmentAssembly is the name of my parent screen and it has > imageview control named imgAssembly. See attached image for reference. > http://monotouch.2284126.n4.nabble.com/file/n4656247/pic1.png > > Look forward to receiving some active help on this matter. > > Many Thanks. > > > > -- > View this message in context: > http://monotouch.2284126.n4.nabble.com/Take-Pictures-with-IPHone-Camera-tp4656124p4656247.html > Sent from the MonoTouch mailing list archive at Nabble.com. > _______________________________________________ > 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/ 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 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 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
