I have something like this:
myViewController = [[MyViewController alloc] initWithNibName:@"MyView" bundle:nil];
[mainCanvas addSubview: myViewController.view];
self.view = mainCanvas;
It will be added at the position (0, 0), but I want to add it at (0, 100) or somewhere else. How can I do so?
Something like this:
myViewController = [[MyViewController alloc] initWithNibName:@"MyView" bundle:nil]; myViewController.view.frame = CGRectMake(0, 100, myViewController.view.frame.size.width, myViewController.view.frame.size.height); [mainCanvas addSubview: myViewController.view]; self.view = mainCanvas;
In addition to setting the frame
property, you can also set the center
property of a view.
Set the frame property on the sub view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With