Programmatically layout iPhone UIView? -


I am using an iPhone toolchain on Linux and therefore I do not have an interface builder. So how can I get my view in my ViewController subclass? For example, I want a UITextView in the middle of the screen? Should I do this in such a loadView or viewDidLoad Do I have to set my view for ViewController subclass?

This is not an easy task, using code here to give some code to all the visual layouts Have gone:

  UITextView * textView = [[UITextView alloc] initWithFrame: CGRectMake (100, 100, 100, 100)]; [Self.view addSubview: textView];  

The frame is a place (the first and second argument is the X and Y coordinator) and the size (the third and fourth argument is the height and the height of the text view).

In this way, you can add any view to your class. Some scenes have been created and you do not want to attract yourself, some of them are not, and you need UIView subclass and drawRect override.

You should see this when you are loading your main view controller


Comments