ScrollView and drawRect

Ask a Question related to Mac Programming, Design and Development.

  1. #1

    Default ScrollView and drawRect

    The view is made with Interface Builder as Custom View and
    the scrollview is build with the "Layout -> Make subview of -> Scroll View" menu

    The view hold some text and graphics all done in drawRect method.

    Each time a scroll is needed (mouse click in arrow) drawRect is called.
    But there is no need to redraw anything since there is nothing new (text
    or graphics)
    in the custom view. Every text and graphics was already made in the custom view
    by the previous drawRect call, even the ones that not covered by the
    scroll rectangle.

    If I force drawRect to do nothing when a mouse click in lower arrow
    happen, an empty rectangle
    appear at the bottom of the view rectangle.

    Is there any way to rebuild text and graphics only when some change
    was made in these text and graphics ?

    My scrolling is too slow because drawRect must compute each time
    a large rectangle of text and graphics. How to do this work only one time
    and just show other part of the text and graphics rectangle when scrolling
    happen ?
    Alain Birtz Guest

  2. Similar Questions and Discussions

    1. Problems using unscaledWidth and drawRect inupdateDisplayList
      Please help me with this one, it has to be a bug of some sort because it makes no sense. Maybe you have an answer or know a better way to do this. ...
    2. (the stage). & 'rect','drawRect'?????
      Hi, I have a MIAW which I initially want to open as 320x240. Fine- no problem. Then, I want to let the user click a sprite to make the MIAW...
    3. the stage.drawrect
      I'm trying to scale my movie to fit the user's screen. The movie was designed at 1024x768. I've tried to automatically scale the movie using: ...
  3. #2

    Default Re: ScrollView and drawRect

    In <abz-1209030929190001@192.168.1.3> Alain Birtz wrote:
    > The view is made with Interface Builder as Custom View and
    > the scrollview is build with the "Layout -> Make subview of -> Scroll
    > View" menu
    >
    > The view hold some text and graphics all done in drawRect method.
    >
    > Each time a scroll is needed (mouse click in arrow) drawRect is called.
    > But there is no need to redraw anything since there is nothing new (
    > text or graphics) in the custom view. Every text and graphics was
    > already made in the custom view by the previous drawRect call, even
    > the ones that not covered by the scroll rectangle.
    >
    > If I force drawRect to do nothing when a mouse click in lower arrow
    > happen, an empty rectangle
    > appear at the bottom of the view rectangle.
    >
    > Is there any way to rebuild text and graphics only when some change
    > was made in these text and graphics ?
    >
    > My scrolling is too slow because drawRect must compute each time
    > a large rectangle of text and graphics. How to do this work only one
    > time and just show other part of the text and graphics rectangle when
    > scrolling happen ?
    Store the drawn computed "large rectange of text and graphics" in an
    NSImage. Now when drawRect is called, just grab the correct part of that
    image. Also make sure drawsBackground is set to YES. m.


    --
    matt neuburg, phd = [email]matt@tidbits.com[/email], [url]http://www.tidbits.com/matt[/url]
    REALbasic: The Definitive Guide! 2nd edition!
    [url]http://www.amazon.com/exec/obidos/ASIN/0596001770/somethingsbymatt[/url]
    Subscribe to TidBITS. It's free and smart.
    matt neuburg Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139