0
votes

I have a subclassed UIView with a special behavior.

It is a custom class of a ViewController xib view. It contains a subview, which is currently created programmatically.

My question is; how to pass a subview either from the xib or from one created programmatically in the viewController via initWithFrame or initWithCoder to my subclassed view? (Right now it simply acts through the view, not initiated at all in the VC.)

I would share code, but I don't know that it's necessary.

1
Let me know if my answer works for you.Dummy Code

1 Answers

1
votes

Use the initWithFrame method:

SubclassedView *view = [[SubclassedView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[self.view addSubview:view];

Be sure to import #import "SubclassedView.h"