Hi,
I've started programming on Mac OS X in Objective-C and decided to create a little card game. At first I create a command line version. If everything works fine I would like to implement a GUI: Nothing big, just a green window with cards which can be dragged and dropped.
Since I don't have any idea about how to do this: What can I ...
It can be done by mallocing a temporary bitmap with 32bits per pixel
and then clearing the alpha component with a for loop and
and finally turn it back into a NSImage again.
I suspect is can be done in a simpler way using a clever
combination of NSColor and NSCompositingOperation. Or perhaps the image
needs to be composited with itsel...
How can I write a YUV frame data into a CGContext?
...
Here's what I've got so far:
NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:
[file.image TIFFRepresentation]];
// Resize image to 200x200
CGFloat maxSize = 200.0;
NSSize imageSize = imageRep.size;
if (imageSize.height>maxSize || imageSize.width>maxSize) {
// Find the aspect ratio
CGFloat aspectRatio = imag...
This is kind of a followup to this question. I have the following code:
- (BOOL)applicationShouldHandleReopen:(NSApplication *)app hasVisibleWindows:(BOOL)flag {
NSLog(@"Has visible windows: %d, main window visible: %d", flag, [[app mainWindow] isVisible]);
if (!flag) {
// I need to make mainWindow visible again here. HO...
In a NSManagedObject Sub Class I have the code …
- (void) awakeFromInsert {
[self addObserver:[NSApp delegate] forKeyPath:@"name" options:NSKeyValueObservingOptionNew context:nil];
}
Which adds my App Delegate as an Observer, what I want to do now is from inside my App Delegate, I want to remove itself as an Observer for my NSManag...
I have a superclass and a subclass, both of which define instance variables.
Rough outline of superclass:
/* GenericClass.h */
@interface GenericClass : NSObject {
/* some variables */
}
@end
/* GenericClass.m */
@implementation GenericClass
/* ... */
@end
Outline of subclass:
/* SpecificClass.h */
#import "GenericClass.h"
...
I've built a video viewer that is a Safari plugin that displays video from networked devices. The viewer reads bitmap images, prepares them, and sets them on the NSImageView object as follows:
NSBitmapImage *bmImg = [[NSBitmapImage alloc] initWithBitmapDataPlanes: . . .]
NSImage *img = [[NSImage alloc] init];
[img addRepresentation:bmI...
Hi,
I need to pick string valur from an NSMutableArray then save it into a plist. I've builded an NSMutableArray to display infos in table View. Maximum allowed index is 8. (paste just two in example)
The problem if the String doesn't exist, I get the following error:
sDict is a dictionary for saving datas to a property list file.
th...
How do I declare a simple string "test" to a variable?
...
Can anyone show me a clear example of how to use
CGImageRef CGImageCreate
(
size_t width,
size_t height,
size_t bitsPerComponent,
size_t bitsPerPixel,
size_t bytesPerRow,
CGColorSpaceRef colorspace,
CGBitmapInfo bitmapInfo,
CGDataProviderRef provider,
const CGFloat decode[],
bool shouldInterpolate,
CGCo...
My application is currently using SSCrypto.framework to decrypt a string encrypted with Blowfish. SSCrypto utilizes OpenSSL which is a new problem for me. Using the 10.6 base SDK while targeting 10.5 doesn't seem to work. The issue is explained in this Apple Mailing List thread: http://lists.apple.com/archives/Cocoa-dev/2009/Aug/msg01737...
Early versions of our app will only support a limited number of currencies. If a user should try to use our app with an unsupported currencyCode then I'd like to set the currencyCode to one that is supported. I'm getting myself confused bouncing between NSNumberFormatters, currencyCodes, NSLocales, etc...
Currently I test the NSNumberF...
Hi all,
I am developing an application in cocoa,I need to calculate the time remaining from NSProgressIndicator .Is that posiible???
Thanks in advance........
...
I'm learning about undo, and I'd like a way to peek into the undo objects (NSInvocations) in the undoManager so I can see what's going on. I couldn't see anything like this in the docs, but maybe someone knows a way.
Thanks.
...
I just started with Cocoa Binding and I am working on my first application.
Many samples and books use the NSArrayController but since I only want to bind a single Object and his properties to some Textfields I used the NSObjectController. I also don't have a document based application. My application is a simple one-window application....
I started using groups in Xcode the same way I use packages in Java or namespaces in C++, even though groups have no effect on the language.
Then I discovered Smart Groups and realised that it's sort of pointless to have my code neatly organised in "folders".
Do you use groups? If so, how and why?
...
I have a very simple bit of code that is supposed to capture the bitmap of a view. This used to work in Leopard, but seems horribly broken in Snow Leopard.
Here is the code, responding to a button press on the window:
- (IBAction)snapshot:(id)sender
{
NSView* view = [[sender window] contentView];
NSBitmapImageRep* bitmap
= [view b...
I am attempting to create a "marching ants" (an animated dashed line) selection indicator around UIView that contains a UIImageView subview. Drawing the dashed line around the perimeter of the UIView is trivial using core graphics:
-(void) drawSelectedMarquee{
CGContextRef c=UIGraphicsGetCurrentContext();
CGContextSetStrokeColorW...
Does the Pantomime Framework work for 10.5 or 10.6? Because when I look at the build error I get when compiling it says, it couldn't find the 10.4 sdk. If not, then does anyone know any other framework that works really well with 10.5 or 10.6, with an example?
...