views:

31

answers:

0

First, sorry for my bad english.

I need help to reload a dynamic UIView with an UIViewController.

In my UIViewController i have an function to build the View Elements like button,labels or other stuff.

CGRect cgRct = CGRectMake(0, 40, 320, 380); //define size and position of view 
UIView *viewContainer = [[UIView alloc] initWithFrame:cgRct];
viewContainer.frame = cgRct;
viewContainer.autoresizesSubviews = YES; 
NSArray *viewElements = [dataController loadFeedElementsWithName:actView.feedName];
for (FeedElements *elements in viewElements) {
    ...
    Stuff to load elements from sqlite database
    ...
    //Give elements data to ViewControl, build elements as Views and add it to my view
    [viewContainer addSubview:[viewController getView:elements.element_type withElements:elements andEvent:feedConnection forAction:connectionToFeed]];
}
for(UIView *lastView in self.viewContainerController.view.subviews){
    [lastView removeFromSuperview];
}
[self.viewContainerController.view addSubview:viewContainer];
[self.viewContainerController.view setNeedsDisplay];
[viewContainer release];

The ViewCotroller builds my elements as UIViews and registers Actions like click in an Event Controller. That is ok. First time i run my App the View is ok but if i clicked an button to jump in myˆnext View nothing is to see.

In my console i can see that the function runs perfect, collect all data and build my View Elements, but the app dont reload the content.

Can anyone help me?

I have tried many solutions from google and stackoverflow but nothing is help e. I think i have forgotten a little thing but i dont no what.

I used an emtpy View in an xib File in my Code viewContainerController is the UIViewController in my Xib File with an View connected to self.view.