Re: Drawing from lower left, why?
Re: Drawing from lower left, why?
- Subject: Re: Drawing from lower left, why?
- From: Ken Tozier <email@hidden>
- Date: Fri, 15 Jun 2007 19:26:03 -0400
On Jun 15, 2007, at 7:05 PM, Ricky Sharp wrote:
On Jun 15, 2007, at 5:34 PM, Ken Tozier wrote:
Since February, I've spent probably a solid month just trying to
make a custom view look the way I want. Because of Apple's draw
from the lower left silliness, this view has been, by a very wide
margin, hardest part of my whole application.
Apparently, the only way to draw from the upper left is to flip
the view. If you flip a view, you have to invert all calculations
(and think upside down) . If you use any GUI widgets, you have to
subclass them and flip them too. If you add transforms to the mix,
that affects subview spacing and text size calculation. if you
resize the window, and want the subviews near the top to look like
they haven't moved, you have to completely recalculate everything
in the view. If there are auto-hidden scrollbars, you have to
query the view on each draw and completely recalculate everything
so the scrollbar show/hide doesn't shift everything over to the
left. Add to all this the headache of adding tracking rectangles
and highlighting and the whole thing becomes a freaking nightmare.
Rather than posting a rant, please describe the exact problems
you're having. For one, it's not clear what type of tranforms
you're applying. Unless the transforms perform scaling, I don't
see how flipped vs. non-flipped will change subview spacing or text
size
In terms of recalculating subviews, have you set up the correct
springs in IB?
Why did Apple subject us to this bass-ackwards way of drawing? The
natural way to read information (at least 90+ percent of the time)
is from top to bottom I just don't understand their logic and it
makes drawing a living hell.
One could argue that _not_ using cartesian coordinates is being
backwards. But Apple provides APIs to work with both coordinate
systems, so it's not an issue. Personally, the only time I use
flipped views would be if the view contains multiple cells (e.g.
matrix, table). Being flipped in that case does make things easier
(since as you move down the view, both the y-coordinate and index
of your cells increase).
Again, please post specific problems you're having. From what you
write above, it really sounds like you're "fighting the framework".
The tone was a rant but it also lists the exact problems I'm having.
I have a custom matrix (not descended from NSMatrix) that I want to
behave similarly to iPhoto's thumbnail view. I don't like iPhoto's
implementation because the photos seem to grow in a fixed sized cell
and when they reach a threshold, the whole view jumps jarringly to
the next largest cell size. My implementation (aside from the
vertical placement bugs) is much smoother and easier on the eyes. I
have the cell scaling and horizontal placement mostly worked out
(except for the vertical scroller pushing everything left on hide/
show) but after literally weeks of trying, I can't get them placed
exactly where I want them vertically.
The superview is a scroll view and although the horizontal scroller
is disabled, I still have to account for it's depth as calling the
scroll view's "contentSize" method returns the size minus the
nonexistent horizontal scroller. Which necessitates manually querying
the scroll view for it's scroller size, and manually adding this to
the returned contentSize. That's just one small facet of the dozen or
so problems trying to get the cells placed correctly
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden