Questions tagged [setneedsdisplay]

124 questions
72
votes
1 answer

setNeedsLayout and setNeedsDisplay

What is the real difference between UIView methods setNeedsLayout and setNeedsDisplay? As usual documentation is foggy about this.
Duck
  • 34,902
  • 47
  • 248
  • 470
68
votes
5 answers

When do I need to call setNeedsDisplay in iOS?

When creating an iOS app, I'm confused as to when exactly I need to call setNeedsDisplay? I know that it has something to do with updating/redrawing the UI; however, do I need to call this every time I change any of my views? For example, do I need…
Nosrettap
  • 10,940
  • 23
  • 85
  • 140
10
votes
2 answers

SetNeedsDisplay not working

I saw many threads related to this issue, but none addresses my case (I think). My case should be simple, I have a Custom UIView in my controller, from my controller, I use the [self.myView setNeedsDisplay] and it works perfectly. I'm having…
Plauto Abreu
  • 449
  • 1
  • 4
  • 9
7
votes
3 answers

setNeedsDisplay not working inside a block

I'm using CMMotionManager for retrieving accelerometer data. The thing is that the accelerometer data gets printed periodically, the instance variables are changed in the view, but the view doesn't get redrawn. I have checked that hv is not nil and…
jorurmol
  • 117
  • 5
7
votes
2 answers

setNeedsDisplay does not trigger drawRect in subviews as expected

I'm struggling with setNeedsDisplay. I thought it was supposed to trigger calls of drawRect: for the view for which it is called and the hierarchy below that if it's within the view's bounds, but I'm not finding that to be the case. Here is my…
Victor Engel
  • 2,037
  • 2
  • 25
  • 46
6
votes
2 answers

Having UIView drawRect occur in a background thread

I would like to have a UIView subclass that implements a method similar to setNeedsDisplay, except that redrawing (i.e., that would usually be called via drawRect:) will occur in a background thread sometime soonish, rather than at the end of the…
Benjohn
  • 13,228
  • 9
  • 65
  • 127
6
votes
1 answer

Using NSTimer to call SetNeedsDisplay in Xamarin for iOS

I have a UIView that takes data (thats changing) from a buffer and plots it. I want the screen udpated at 10Hz. The UIView is called pane, and this is how i'm invoking it inside the ViewController: //create graphics to display data …
reza
  • 1,329
  • 2
  • 22
  • 37
5
votes
3 answers

reload/refresh subViews - setNeedsDisplay doesnt work

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…
brush51
  • 5,691
  • 6
  • 39
  • 73
5
votes
2 answers

Does setNeedsDisplay:NO have any use at all?

In Cocoa, when we want to redraw a view, we would send the view a setNeedsDisplay: message telling the view to redraw itself with a parameter of YES. I was wondering if there are any circumstances where you would want to send a view…
TheAmateurProgrammer
  • 9,252
  • 8
  • 52
  • 71
4
votes
2 answers

How to create a flexible frame for photo in iPhone?

I try to create a flexible frame for in my iPhone app with some small pictures. CustomView inherit UIView and override it's setFrame: method. In setFrame:, I try to call [self setNeedsDisplay]; Every time I scale the photo, this frame really display…
wcrane
  • 1,195
  • 7
  • 18
4
votes
1 answer

setNeedsLayout in UIView subviews

I have a UIViewController and in willRotateToInterfaceOrientation, i am calling [self view] setNeedsLayout]; This view call's it's subview's (a UIScrollView) layoutSubviews method, but the UIScrollView doesn't call layoutSubviews for it's subviews.…
0xSina
  • 20,973
  • 34
  • 136
  • 253
4
votes
1 answer

Does setNeedsDisplay have immediate effect or it is merely queued for later?

Does anybody here know whether setNeedsDisplay results in an immediate drawRect call and immediate updating of the screen? Or is it merely a queued request? Thanks.
Hupe
  • 41
  • 1
  • 3
3
votes
5 answers

Confusion about UIView's setNeedsDisplay

I have an ivar of UITableView* myTableView. I have data being loaded from internet so when the data gets loaded should i call [myTableView setNeedsDisplay], i know i can/should call [myTableView reloadData] but the confusion is that calling…
Satyavrat
  • 139
  • 1
  • 10
2
votes
1 answer

UIScrollView subviews and setNeedsDisplay

I've the following problem : I have a UIView containing a UIScrollView as a subview. (nib file). Programmatically I add several subviews (UIImageView) to the UIScrollView, each UIImageview contains an image loaded from the net asynchronously, so I…
oiledCode
  • 8,589
  • 6
  • 43
  • 59
2
votes
3 answers

iOS: How to "Refresh" a UIViewController after Popping its Child UIViewController?

In my app I'm using UINavigationController. I have a "parent" UIViewController and a "child" UIViewController running on the stack. The user can do some settings on the child that are later on suppose to affect the parent. I use NSUserDefaults to…
1
2 3
8 9