小编Dha*_*raj的帖子

如何使NSView移动到所有NSView的前面

我有一个超级视图,它有2个子视图.这些子视图是重叠的.

每当我从菜单中选择一个视图时,相应的视图应该成为前视图并处理动作.也就是说,它应该是最前面的子视图.

acceptsFirstResponder辞去所有工作.但是鼠标按下事件被发送到已设置的最顶层子视图.

此致,Dhana

cocoa nsview

32
推荐指数
3
解决办法
2万
查看次数

Cocoa Objective-c Property C结构赋值失败

我想更改变量值,它是另一个类的结构的成员.但价值并没有改变.

这是代码.

//Structure..

typedef struct {
    int a;
    double b;
} SomeType;


//Class which has the structure as member..
@interface Test2 : NSObject {
    // Define some class which uses SomeType
    SomeType member;

}

@property SomeType member;

@end


@implementation Test2

@synthesize member;

@end


//Tester file, here value is changed..
@implementation TesstAppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    // Insert code here to initialize your application 

    Test2 *t = [[Test2 alloc]init];

    t.member.a = 10;
//After this the value still shows 0 …
Run Code Online (Sandbox Code Playgroud)

cocoa structure properties objective-c

10
推荐指数
1
解决办法
7345
查看次数

CGImage创建具有所需大小的缩略图图像

我想用CG创建缩略图.它会创建缩略图.

在这里,我想要缩放1024的大小(纵横比.)是否可以直接从CG获得所需的大小缩略图?

在选项字典中我可以传递thumnail的最大大小可以创建,但有没有任何方法可以有相同的最小尺寸..?

 NSURL * url = [NSURL fileURLWithPath:inPath];
 CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, NULL);
 CGImageRef image=nil;
 if (source)
 {
  NSDictionary* thumbOpts = [NSDictionary dictionaryWithObjectsAndKeys:
           (id) kCFBooleanTrue, (id)kCGImageSourceCreateThumbnailWithTransform, 
           (id)kCFBooleanTrue, (id)kCGImageSourceCreateThumbnailFromImageIfAbsent,
           [NSNumber numberWithInt:2048],  kCGImageSourceThumbnailMaxPixelSize,

           nil];

  image = CGImageSourceCreateThumbnailAtIndex(source, 0, (CFDictionaryRef)thumbOpts);   

  NSLog(@"image width = %d %d", CGImageGetWidth(image), CGImageGetHeight(image));
  CFRelease(source);
 }
Run Code Online (Sandbox Code Playgroud)

size core-graphics thumbnails

9
推荐指数
1
解决办法
6711
查看次数

2
推荐指数
1
解决办法
357
查看次数

CoreImage修补了10.6中的问题

在10.6中使用某些系统CoreImage CIPerspectiveTransform(以及其他api也是如此)会在输出图像中产生彩色色块.(看起来像硬件相关的问题它只发生在分辨率高于4000X2500的图像上)

有没有办法摆脱这个错误?最后是否可以使用NSAffineTransform?如果是,如何使用它.

谢谢,Dhana.

macos core-image osx-snow-leopard

1
推荐指数
1
解决办法
577
查看次数