动态结果和覆盖数据 [英] Dynamic Results and Covering Data

查看:134
本文介绍了动态结果和覆盖数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天我有一个问题,从这个问题:可可数据库结果。它是关于使用数据库返回的数据来创建一定数量的问题。我使用以下代码的形式(这是在问题中发布的)。

  NSMutableDictionary * interfaceElements = [[NSMutableDictionary alloc ] 在里面]; 

for(NSInteger i = 0; i //这只是为了使一个框架缩进10px
//,并且有10px (或窗口边缘)
NSRect frame = NSMakeRect(10,(i * 22 +(i + 1)* 10),100,22);
NSTextField * newField = [[NSTextField alloc] initWithFrame:frame];
//正确配置newField
[[myWindow contentView] addSubview:newField];
[interfaceElements setObject:newField forKey:@someUniqueIdentifier];
[newField release];但是,现在当我尝试使用IFVerticallyExpandingTextfield(从 http://www.cocoadev.com/index.pl?IFVerticallyExpandingTextFieldrel =nofollow noreferrer> http://www.cocoadev.com/index.pl?IFVerticallyExpandingTextField ),或创建大量的文本,它只是覆盖其他绘制的内容。我尝试使用setAutosizingMask:对对象,但它还没有工作到目前为止。



感谢任何帮助。



编辑:我想要的效果看起来像是正确的TextField,发生了什么叫做StackOverflow Sample - http://www.mediafire.com/?sharekey=bd476ea483deded875a4fc82078ae6c8e04e75f6e8ebb871



编辑2:如果没有人知道如何使用这个IFVerticallyExpandingTextfield类,任何人都知道是否有另一种方法来完成这个效果?

解决方案

这是你的意思吗?



http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/GraphicsContexts/GraphicsContexts.html



您的问题对我来说不是很清楚,但这可能有助于^^^。



看看修改当前图形状态页。



刚刚从正确的文本字段示例复制代码并在应用程序中使用它?





http://www.cocoadev.com/index.pl?IFVerticallyExpandingTextField 说:


试试看吧!你应该能够
将这个进入一个项目,在Interface Builder中读取
文件,并使用
自定义类面板将
NSTextField变成
IFVerticallyExpandingTextField。你将
需要设置布局和
换行属性为
换行。



虽然扩展应该工作
正确的当textfield是
嵌入在一个子视图,我有一些
麻烦处理NSScrollViews。
该字段扩展到
scrollview的内容视图,但是不会出现
滚动条上的控件。
这里的一些帮助将不胜感激。



Today I have a question that sprouted off of this one: Database Results in Cocoa. It's regarding using the data that was returned by a database to create a certain number of questions. I am using a form of the following code (this was posted in the question).

NSMutableDictionary * interfaceElements = [[NSMutableDictionary alloc] init];

for (NSInteger i = 0; i < numberOfTextFields; ++i) {
  //this is just to make a frame that's indented 10px
  //and has 10px between it and the previous NSTextField (or window edge)
  NSRect frame = NSMakeRect(10, (i*22 + (i+1)*10), 100, 22);
  NSTextField * newField = [[NSTextField alloc] initWithFrame:frame];
  //configure newField appropriately
  [[myWindow contentView] addSubview:newField];
  [interfaceElements setObject:newField forKey:@"someUniqueIdentifier"];
  [newField release];
}

However, now when I attempt to use IFVerticallyExpandingTextfield (from http://www.cocoadev.com/index.pl?IFVerticallyExpandingTextField), or create any large amount of text, it simply goes over the other drawn content. I looked into using setAutosizingMask: on the object, but it has not worked so far.

Thanks for any help.

EDIT: What I want the effect to look like is called "Correct TextField" and what happens is called "StackOverflow Sample" - http://www.mediafire.com/?sharekey=bd476ea483deded875a4fc82078ae6c8e04e75f6e8ebb871.

EDIT 2: And if no one knows how to use this IFVerticallyExpandingTextfield class, would anyone know if there is another way to accomplish the effect?

解决方案

Do you mean this?

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/GraphicsContexts/GraphicsContexts.html

Your question is not very clear to me but this might help ^^^.

Look at 'Modifying the Current Graphics State' on that page.

What about just exactly copying the code from the 'Correct textfield' example and use it in your application? Or start your application from the 'Correct texfield' example.

Also

A comment on http://www.cocoadev.com/index.pl?IFVerticallyExpandingTextField says:

Give it a try! You should be able to throw this into a project, read the files in Interface Builder, and use the custom class pane to make an NSTextField into an IFVerticallyExpandingTextField. You'll need to set the layout and linebreaking attributes for word wrapping for this to work.

Although expansion should work properly when the textfield is embedded in a subview, I'm having some trouble dealing with NSScrollViews. The field expands into the scrollview's content view, but none of the controls on the scrollbar appear. Some help here would be appreciated.

这篇关于动态结果和覆盖数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆