setneedsdisplay

setNeedsDisplay does not trigger drawRect in subviews as expected

余生颓废 提交于 2019-12-07 03:09:43
问题 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 setup: From the application delegate, I create a view whose size is a square that covers essentially the whole screen real estate. This view is called TrollCalendarView . There is not much that happens with TrollCalendarView except for a rotation

iOS: How to get background thread to redraw view on main thread

好久不见. 提交于 2019-12-06 12:07:06
My application will query a database 50 times and will then react accordingly by adding the right UIImageView to another UIImageView, which I then want the application to display immediately at each loop. Alas, after many nights I have failed to get it to work. The application will not immediately display the UIImageView. Having said that, when I zoom in or zoom out during mid loop the UIImageViews will appear! I must be missing something... So far every code works except the last part [UIScrollView performSelector.... Please help and thank you in advance. UIScrollView *firstView; UIImageView

setNeedsDisplay does not trigger drawRect in subviews as expected

冷暖自知 提交于 2019-12-05 09:11:28
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 setup: From the application delegate, I create a view whose size is a square that covers essentially the whole screen real estate. This view is called TrollCalendarView . There is not much that happens with TrollCalendarView except for a rotation triggered by the compass. There are 7 subviews of TrollCalendarView called PlatformView intended to contain

SetNeedsDisplay not working

こ雲淡風輕ζ 提交于 2019-12-03 13:04:38
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 problems when Im trying to call this from inside of the UIView itself...I have a notification being sent from another class, and it is being received by my View (this works) with the information it passes, I update internal properties of this view and than I'm calling the [self setNeedsDisplay ] wishing to have my screen updated with the new states, but

Having UIView drawRect occur in a background thread

余生颓废 提交于 2019-11-28 11:28:05
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 current update cycle. It might be called setNeedsAsynchronousDisplay . Or the existing setNeedsDisplay could get hijacked and not cause redraw at the end of the cycle, or whatever, as long as it lets the redraw not happen on the main thread blocking screen updating an interaction until its completed. Until the redraw occurs, the view can continue to

When do I need to call setNeedsDisplay in iOS?

泪湿孤枕 提交于 2019-11-27 10:23:29
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 to call it: After programatically changing the text in a text field When changing the background of a view? When I make changes in viewDidLoad? How about in viewDidAppear? Could someone give me some general guidelines regarding when to use this method? You should only be calling setNeedsDisplay if you override drawRect in a subclass of UIView which

setNeedsLayout and setNeedsDisplay

流过昼夜 提交于 2019-11-27 06:26:45
What is the real difference between UIView methods setNeedsLayout and setNeedsDisplay ? As usual documentation is foggy about this. Actually the documentation is pretty clear about this: setNeedsLayout will layout subviews Call this method on your application’s main thread when you want to adjust the layout of a view’s subviews. setNeedsDisplay will call for a redraw of your view ( drawRect: , etc). You can use this method or the setNeedsDisplayInRect: to notify the system that your view’s contents need to be redrawn. 来源: https://stackoverflow.com/questions/14506968/setneedslayout-and

When do I need to call setNeedsDisplay in iOS?

徘徊边缘 提交于 2019-11-26 15:07:40
问题 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 to call it: After programatically changing the text in a text field When changing the background of a view? When I make changes in viewDidLoad? How about in viewDidAppear? Could someone give me some general guidelines regarding when to use this

setNeedsLayout and setNeedsDisplay

被刻印的时光 ゝ 提交于 2019-11-26 11:59:44
问题 What is the real difference between UIView methods setNeedsLayout and setNeedsDisplay ? As usual documentation is foggy about this. 回答1: Actually the documentation is pretty clear about this: setNeedsLayout will layout subviews Call this method on your application’s main thread when you want to adjust the layout of a view’s subviews. setNeedsDisplay will call for a redraw of your view ( drawRect: , etc). You can use this method or the setNeedsDisplayInRect: to notify the system that your view