Users adding views
I have created a main page (myAppViewController) and a add page rect button I have also created a pag开发者_如何转开发e template (TemplateAViewController) all set up in Interface builder. I would like users to be able to add as many templates themselves and then page through them.
I am not sure where to start. I can create views programmatic like so
-(IBAction)createnewpage : (id) sender {
myAppViewController *viewcontroller = [[myAppViewController alloc] initWithNibName:@"TemplateAViewController" bundle:[NSBundle mainBundle]];
[[self view] addSubview:viewcontroller.view];
}
I then want to be able to navigate through these views- I guess I need to create a navigation controller to do this ?
Btw this is for iPad ONLY
By navigation if you mean access the views programmatically, just do :
for (UIView *view in [self view].subviews) {
...
}
Edit:
Looking at your code, it seems that you were adding all views as subviews to a view of a fixed UIViewController [[self view] addSubview:customView]
Based on that, you can access each subview of your view controller from the mentioned for loop
.
I hope I am clear now
精彩评论