Hi Miljenko. Create and add an UIView to the window and add the button to the view, i think that's the problem.
On my beginings with MonoTouch I did something similar and I learnt that is a baaad idea to do not have a UIViewController in an iOS app, things linke rotation will not work without it. And to design views, sure, you can use XCode, remove everything automatically created and add an UIView to the design, this way you can then load the views from the .xib and add them to the window. Cheers 2012/11/7 Miljenko Cvjetko <[email protected]> > got requirement for UIViewController-less iOS app (story is a bit > longer), so following code produces only black screen in iOS simulator: > > public override bool FinishedLaunching (UIApplication app, > NSDictionary options) > { > // create a new window instance based on the screen size > window = new UIWindow (UIScreen.MainScreen.Bounds); > > // If you have defined a view, add it here: > // window.AddSubview (navigationController.View); > > > UIButton button = new UIButton(); > button.Frame = new System.Drawing.RectangleF(100,100, 100,20); > button.SetTitle("Test", UIControlState.Highlighted); > button.Hidden = false; > > window.AddSubview(button); > > // make the window visible > window.MakeKeyAndVisible (); > > return true; > } > Result: Blank screen > > Application Output (iOS6 simulator): > > 2012-11-07 09:43:17.945 XampleXibbedWithModifiedXib[756:1607] > Application windows are expected to have a root view controller at the end > of application launch > Steps: 1. Empty MonoTouch application > > In app delegate add code (above) > The idea is to insert custom UIView instead of UIButton. > > Questions: > > > 1. is this way to go? > 2. is at least one UIViewController necessary? > 3. possible caveats? > 1. besides losing some of native event handling like gestures and > touches, orientation > 2. iOS 6 requires controllers will this be more strict in the > future? > 4. Xcode creates class derived from UIViewController... > Can this be changed to let say: UIView? > To use Xcode just as plain designer for Views? > > > thanks > > m > > -- > Miljenko Cvjetko dipl.ing. ET > Direktor/CEO > Projektant rješenja/Solution Architect > Razvojni programer/Senior developer > Voditelj projekta/Project Manager > > IX južna obala 13 > Kajzerica Zagreb > T: 385 1 7775555 > M: 385 91 557 447 3 > F: 385 1 7779556 > e: [email protected] > w: http://holisticware.net > > > _______________________________________________ > MonoTouch mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/monotouch > >
_______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
