在Safari中使用Webkit的CSS3; 我有一个按钮,当点击时,会导致div淡入.这个div只是一个大的填充矩形,里面有几个按钮,其中一个按钮可以淡出相同的div.
问题是:当元素淡出(不透明度:0),然后单击其中一个按钮所在的位置时,onClick仍然被触发.换句话说,即使无法看到按钮(不透明度:0),它仍然存在并且是事件模型的一部分.我不希望这样.
按钮调用以下功能:
// This displays the overlay (popup)
function showCategoryPopup() {
// Was playing with the following, but with no success.
// popupCategory.style.display = "block";
// popupCategory.style.visibility = "visible";
// Change the attributes that will be animated.
popupCategory.style.opacity = 1;
popupCategory.style.webkitTransform = "scale(1.0)";
}
function hideCategoryPopup() {
// Change the animated attributes
popupCategory.style.opacity = 0;
popupCategory.style.webkitTransform = "scale(0.7)";
// Even if opacity is 0, we still get mouse events. So, make it hidden?
// popupCategory.style.visibility = "hidden";
// …Run Code Online (Sandbox Code Playgroud) 我总是在代码中创建我的NSFetchRequests.现在我正在寻找Xcode GUI来构建一个获取请求并将其存储在模型中.
我正在关注Xcode文档中的一个示例.我向模型添加了一个获取请求,并且通过Modeling GUI创建的谓词是:
firstName LIKE[c] "*SUBSTRING*"
Run Code Online (Sandbox Code Playgroud)
然后我用这两行检索该请求:
NSDictionary *substituionDictionary = [NSDictionary dictionaryWithObject:@"woody" forKey:@"SUBSTRING"];
NSFetchRequest *fetchRequest = [mom fetchRequestFromTemplateWithName:@"firstNameContains" substitutionVariables:substituionDictionary];
Run Code Online (Sandbox Code Playgroud)
生成的NSFetchRequest的NSLog输出:
(entity: Customer; predicate: (firstName LIKE[c] "*SUBSTRING*"); sortDescriptors: (null); limit: 0)
Run Code Online (Sandbox Code Playgroud)
..表示在返回存储的FetchRequest之前未替换变量.
那么,如何指定在Xcode数据建模获取请求谓词生成器GUI中输入的文本将在运行时由NSFetchRequest替换:fetchRequestFromTemplateWithName:substitutionVariables:?
谢谢!
伍迪
cocoa core-data data-modeling nspredicateeditor nsfetchrequest
我正在以编程方式更改可可绑定.我将NSTextField的值绑定到ArrayController的选择.手动更改绑定后,我得到"不符合键值的键值编码"错误,键是旧键,而不是新键.
看看代码:
NSTextField *textField = [self listTextField];
NSDictionary *currentBindInfo = [textFieldTableViewCell infoForBinding:NSValueBinding];
NSLog(@"pre-change bindings for textField: %@", currentBindInfo);
/* Change the binding. [Tried unbind: first, no difference] */
[textField bind:NSValueBinding
toObject:[currentBindInfo valueForKey:NSObservedObjectKey]
withKeyPath:@"objectValue.iLifeProductName"
options:[currentBindInfo valueForKey:NSOptionsKey]];
/* Log the info so we can confirm it changed. debugging. */
NSLog(@"post-change bindings for textField: %@", [textFieldTableViewCell infoForBinding:NSValueBinding]);
Run Code Online (Sandbox Code Playgroud)
要进行故障排除,我在更改之前和之后调用'infoForBinding',它看起来要正确更改.我可以看到旧值,然后我调用bind:toObject ...并再次转储infoForBinding,并且绑定的值已更改:
2011-07-06 22:36:23.137 My App 2011[14640:407] pre-change bindings for listTextFieldTableViewCell: {
NSObservedKeyPath = "selection.osxProductName";
NSObservedObject = "...sameTextField... 0x4009cc380>";
NSOptions = {...same... };
}
2011-07-06 22:36:23.138 …Run Code Online (Sandbox Code Playgroud) 我有一个NSManagedObject子类与CoreDataGeneratedAccessors如下:
- (void)addCoursesObject:(Course *)value;
- (void)removeCoursesObject:(Course *)value;
- (void)addCourses:(NSSet *)value;
- (void)removeCourses:(NSSet *)value;
Run Code Online (Sandbox Code Playgroud)
使用上面的访问器添加或删除对象时,我需要运行一些其他代码.
我实际上想在实现文件中做这样的事情:
-(void)addCoursesObject:(Course *)value {
[super addCoursesObject:value];
… my additional code here … }
Run Code Online (Sandbox Code Playgroud)
但是super没有意义,因为NSManagedObject没有"-addCourseObject".在课程中添加一个观察者NSSet似乎也许是一种方法,但我宁愿只实现自己的访问器,然后定义它是如何工作的,就像实现@synthesized访问器超出默认行为时一样.
有没有办法调用原始行为,类似于上面的'[super ...'行?
思考?其他方法?
谢谢.
我想从我的tableview中拖出一行并将其放入Mac OS X 10.6中的任何其他NSTextField中,并删除一串文本.
拖放已经在我的应用程序中工作(在NSTableView和NSBrowser之间),但我没有成功将任何数据放在粘贴板上,除了源应用程序之外的应用程序可以接受.
这是我尝试过的代码,当我进入其他一些NSTextField时,我认为这样就足以让"hello"这个词被"粘贴"了:
-(BOOL) tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard {
[pboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self];
[pboard setString:@"hello" forType:NSStringPboardType];
return YES;
Run Code Online (Sandbox Code Playgroud)
}
// -
我从来没有得到光标,告诉我下降将被接受,它只是不起作用.
以上都没有奏效.我认为我的概念是正确的:"编码数据,告诉粘贴板你有什么,然后给它数据",但由于其他应用程序无法识别它,我怀疑我没有告诉粘贴板正确的数据类型.
我哪里错了?
谢谢,伍迪
我认为这很简单:
我想为WebView添加上下文菜单.
在IB中,我向NIB添加了一个NSMenu,将其连接到WebView的菜单插座,启动并期望能够在WebView中进行控制点击并查看弹出菜单.我在上下文菜单中看到的唯一项目是"重新加载".我可以执行相同的步骤,但将菜单连接到其他视图,它按预期工作.
连接到webview的菜单插座时,为什么菜单不能正常工作?
谢谢