i have trouble with setNeedsDisplay. I have an UIView with a lot of sub UIViews, created in Inteface Builder. I have also an Button with IBAction. In this IBAction i want to redraw/reload all UIViews (or all UIElements, like UILabel, UIWebView and so on..)
I am doing this, which doesn't work for me, dont know why.. :
//redraw the UIViews
[self.view_card_0 setNeedsDisplay];
[self.view_card_1 setNeedsDisplay];
[self.view_card_stapel setNeedsDisplay];
//other UI Elements
[self.webView_0 setNeedsDisplay];
[self.webView_1 setNeedsDisplay];
[self.webView_stapel setNeedsDisplay];
[self.lblCardTitle_0 setNeedsDisplay];
[self.lblCardTitle_1 setNeedsDisplay];
[self.lblCardTitle_stapel setNeedsDisplay];
[self.img_card_0 setNeedsDisplay];
[self.img_card_1 setNeedsDisplay];
[self.img_card_stapel setNeedsDisplay];
What to do for redraw/reload/refresh all UIElements/UIViews and Subviews?
EDIT 1:
How i load the view:
detailViewController = [[DetailViewController alloc]
initWithNibName:@"DetailViewController_iPad" bundle:[NSBundle mainBundle]];
The detailviewcontroller has no viewcontroller, just uiviews, here the hierarchie:
- UIView
-- UIViewContainer
--- UIView0
--- UIView1
--- UIViewStapel
What i expect to do:
*I dont want to reset the UIView, i want to change the background and the content of them. *
I have in my detailview a lot of subviews (uiviews), see above hierarchie. I am displaying content in the UIViews, the content comes from coreData.
The view1 contains the current row of coreData.
The view0 contains the previous row of coreData.
The viewStapel contains the next row of coreData.
With IBAction i want to iterate the coreData rows, display the next row in current if the action is called..and so on..
In Log, the data is changed, but not displayed in the UIViews. Cause of this i need a redraw or reload or something like this, to get displayed the current data.
EDIT 2: SOLVED
I have put the code in a new method and calling this method have solved my problem.
-setNeedsDisplay
on some other UI element won't do anything, because if the UI element needs to update its display (in response to changing properties), it will have already called that method on itself. – Mythopoeia