[MonoTouch] Outlets in appDelegate null?
stmc
bsalomons at asiweb.com
Mon Oct 17 11:51:26 EDT 2011
Hi,
I was hoping someone might be able to help me out with a problem I'm having
with my appDelegate and my outlets being null. I have a UITableViewSource
where I've overridden the RowSelected method and added some code to access
an outlet from the appDelegate.
appDelegate.SetFromAccount (accounts[indexPath.Row]);
appDelegate.FromAccountView.RightLabel.Text =
accounts[indexPath.Row].AccountNickName;
The first line executes just fine, but the second line errors because
FromAccountView is null and I'm not sure why. I've used the same outlet to
set the images on the view, so I know I've seen it not be null. Even more
odd is while I was noticing that outlet was null and not working, if I hover
over any other outlet they all show null as well. I'm using this line of
code to get access to my appDelegate
AppDelegate appDelegate =
(AppDelegate)UIApplication.SharedApplication.Delegate;
I'm really not sure what I'm doing wrong, I used the same line of code to
access the appDelegate from some other places and they've all worked fine
with all my outlets available and not null. Am I some how instantiating a
new appDelegate where all the outlets are null? Can outlets in appDelegate
ever be null? Or if I have an outlet to a view should it always be
available? At first I thought maybe the garbage collector was getting rid of
the view I was trying to access. So I've tried adding a property that
accesses the outlet and using that, as well as adding the outlet to a list
in hopes it'd still be there, but the property showed the outlet as null and
the list just said it was empty.
Any insight into the matter would be greatly appreciated,
Thanks
--
View this message in context: http://monotouch.2284126.n4.nabble.com/Outlets-in-appDelegate-null-tp3912475p3912475.html
Sent from the MonoTouch mailing list archive at Nabble.com.
More information about the MonoTouch
mailing list