每当某些 NSView
s -(NSRect) 可见矩形
更改时,我希望得到通知,因为我想在可见矩形的基础上做一些花哨的子视图布局。 坦率地说,现在我立立方了; -visibleRect
没有发出KVO通知(这很有意义),而且似乎也找不到可见矩形是否在明确调用 -visibleRect
的情况下改变。
这是可能的吗? (或是一个可怕的、可怕的想法? )
每当某些 NSView
s -(NSRect) 可见矩形
更改时,我希望得到通知,因为我想在可见矩形的基础上做一些花哨的子视图布局。 坦率地说,现在我立立方了; -visibleRect
没有发出KVO通知(这很有意义),而且似乎也找不到可见矩形是否在明确调用 -visibleRect
的情况下改变。
这是可能的吗? (或是一个可怕的、可怕的想法? )
我认为您可以推翻 < code> - [ NSView updateTrackingAreas] code>, 或者监听 < code> NSViewDid updateTrackingAreas notification code> 。 这些可能发生在更多场合, 不仅仅是可见矩形的改变, 但对于可见矩形的任何改变, 它们应该发生。 我认为 。
这或许是一个可怕的想法。
10.5后的另一个选项是-ViewWillDraw 方法,该方法在绘制视图(及其子视图)之前被调用。您可以在调用 [超级视图 willDraw] 之前获取可见矩形视图并进行布局 。
Ken s 监听跟踪区域更改的建议感觉很黑,但似乎有效,尽管它们只在调整大小完成后触发。如果像我一样在调整大小时需要更新,它压倒了 -[NSView 重新缩放旧视图Size:]
将做到这一点。
The adjustTrackingArea solution does not appear viable in Mojave for NSScrollView at least. Mojave does not appear to always call adjustTrackingArea while scrolling an NSScrollView. Haven t tested other OS versions, other view types.
I ve got the problem when I tried to do asynchronous requests to server from background thread. I ve never got results of those requests. Simple example which shows the problem: @protocol ...
i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...
Is there any way to obfuscate Objective-C Code ? Thanks
Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...
I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...
I am writing an iPhone application which requires the user to enter several values that may contain a decimal point (currency values, percentages etc.). The number of decimal places in the values ...