Created my first control in the MoveMe sample program in the file MoveMeAppDelegate.m, method applicationDidFinishLaunching. Defined size of a text field as a CGRect like so:
CGRect testFrame = CGRectMake(10, 10, 100, 100);
Next I created the object itself:
UITextField *testText = [[UITextField alloc] initWithFrame:testFrame];
To see it, I had to do some extra magic. This somehow adds it as subview. Had to call this after other similar calls to make sure it's not obscured:
[window addSubview:testText];
It wasn't immediately obvious that the field even appeared, but when clicking on the upper left where it is supposed to appear a keyboard did pop up and I was able to type. Stuff I'd like to understand next:
- When am I supposed to release this field?
(in dealloc do [testText release] maybe? nope, didn't work.)
- Why when creating UIViewController it is stored in self, and then released? Won't that destroy it? Apparently not.
- How do I output some debug text?
- How do I monitor the events that the textfield sends? Where does it send them to?