I have a very simple view with a button and a label. In XCode's Interface Builder I ctrl-dragged to get a reference to the UIButton and called it btnPlay
. In my view controller I have this code:
public override void ViewDidLoad()
{
base.ViewDidLoad();
// On my phone this line causes a crash:
Console.WriteLine("Button title: {0}", btnPlay.CurrentTitle);
}
When I run the app in the iPhone Simulator (3.5" Retina / iOS 7.0) all is well. Inspecting btnPlay
at a breakpoint shows it as a MonoTouch.UIKit.UIButton
object.
When I run the app on my iPhone 5C (iOS 7.0.4) btnPlay
shows up as a MonoTouch.UIKit.UIView object which has no CurrentTitle
property and so crashes the app.
What can be the cause of this?