Close: Solved: visibleRect returns bogus results, why?
Close: Solved: visibleRect returns bogus results, why?
- Subject: Close: Solved: visibleRect returns bogus results, why?
- From: Alexander Reichstadt <email@hidden>
- Date: Sat, 11 Jun 2011 16:00:59 +0200
My bad, I made an NSInteger into an NSUInteger the wrong way hence returning an amount of rows for an NSTableview that was incorrect, so the tableview really grew to that size.
Am 11.06.2011 um 15:03 schrieb Alexander Reichstadt:
> No, it's not solved. This works, because it always gives me the same rectangle. As far as I can see this call is broken. As soon as a user drags the scrollbar freely, the numbers go all bunkers as if the visible rectangle had an origin which was a hundred miles down the screen. As a result rowsInRect for tableview doesn't work neither and returns also useless results. Stupid. Is this normal and a known bug, or am I missing something?
>
> Am 11.06.2011 um 14:49 schrieb Alexander Reichstadt:
>
>> Never mind, what works reliably is:
>>
>> NSRect theRect = [[[self view] enclosingScrollView] visibleRect];
>>
>>
>> Am 11.06.2011 um 14:39 schrieb Alexander Reichstadt:
>>
>>> Hi,
>>>
>>>
>>> I have a view with view controller. The controller receives scroll changes. visibleRect returns bogus, so I tracked it with NSLog and confirmed this.
>>>
>>> I use this code:
>>> NSRect theRect = [[self view] visibleRect];
>>> NSLog(@"%@",NSStringFromRect(theRect));
>>>
>>> When I scroll using the scrollwheel or arrows of the scrollbar, it looks good
>>>
>>> 2011-06-11 14:34:06.089 App[20913:903] {{0, 0}, {10, 344}
>>>
>>> When I click onto the dot inside the scrollbar and drag it to another position, it turns to bogus:
>>> 2011-06-11 14:34:09.108 App[20913:903] {{0, 1.21354e+09}, {10, 344}}
>>>
>>> I also tried:
>>> NSRect theRect = [[[self view] enclosingScrollView] documentVisibleRect];
>>>
>>> Same result. Why????
>>>
>>>
>>>
>>> Thanks
>>> Alex
>>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please 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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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