English 中文(简体)
在国家统计研究院招聘一名外地编辑 观点
原标题:Embedding a field editor in a NSScrollView

是否有任何人曾经历过将外地编辑(为NSText Field)纳入滚动观点? I m 试图使NSText外地能够在编辑时浏览。

我曾尝试过:

  1. Dynamically embed it when the custom field editor s -becomeFirstResponder gets called. This semi works; the problem is that when the NSTextField gets resized during editing the custom field editor no longer gets resized with it (and I need this - making an accordion style application)

  2. 在国家安全局的《发展评论》中设立一个“男性”外地编辑,并利用国家就业局向实际的外地编辑传达这些方法。 这是我真正希望采用的方法;我已经采用了以下所有方法:rel=“nofollow”>here;但我收到EXC_BAD_CESS。 每当外地编辑实际装满时(例如,当我打电话<编码>时,[中文本:nil]。 我似乎不抱歉,即便是经过了Zombies,也看上了<代码>的标志。 缩略语 两者都没有结果。 见

最后一个办法是完全放弃NSText Fields,使用NSTextView(或者不依靠外地编辑机制,只写一字),但鉴于我的数据很多,当时只有一卷才能编辑,因此,我不想为其中的每一个人发出NSTextView......但后来,也许会赢得这么坏。

最佳回答

我最后采用备选方案1,并把它放在没有很大困难的情况下工作。 备选案文2是完全死灰复燃的,因为<条码>EXC_BAD_ACCESS在我到处蔓延。

My custom field editor now keeps a reference to a (custom) scroll view to embed itself in (vvScrollView), and inserts it into the view hierarchy. My code inside my custom field editor (NSTextView) for embedding it inside a scroll view, which is called as soon as the field editor becomes first responder and is automatically inserted into the view hierarchy:

- (void)embedSelfInScrollView {
    NSView *realSuperview = [[self superview] superview];
    // [self superview] is some kind of private NSClipView class
    if ([realSuperview isKindOfClass:[NSTextField class]]) { // the expected behavior: this may change? TODO make less prone to chance
        [realSuperview addSubview:[self vvScrollView]]; // insert into view
        [[self vvScrollView] setFrameSize:[realSuperview frame].size]; // se the initial size equivalent to control size so it can autoresize the same way
        // add the scrollview into the view hierarchy
        [[self vvScrollView] setDocumentView:self]; // removes self from previous superview
    }
}

我最初的问题是,我试图在现场编辑(SNCC普通笔记)上,将滚动观点插入“超级概览”,这几乎打破了所有自动消化选择(因为我想能够在编辑时将NSText Field转作)。 采取进一步的步骤和绕过私人阶层似乎在发挥作用,但似乎几乎是任意的。

问题回答

暂无回答




相关问题
Asynchronous request to the server from background thread

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 ...

objective-c: Calling a void function from another controller

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 ...

ABPersonViewController Usage for displaying contact

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 ...

NSArray s, Primitive types and Boxing Oh My!

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 ...

NSUndoManager and runModalForWindow:

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 ...

NSMutableArray values becoming "invalid"

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 ...

iPhone numberpad with decimal point

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 ...

热门标签