cocoa

Saving data with dataWithPDFInsideRect: just makes a black pdf

Hello, I have a QTCaptureView and Im trying to save the view as a picture. So far I have this: NSRect rect = [outputView bounds]; NSData *viewData = [outputView dataWithPDFInsideRect:rect]; [viewData writeToFile:@"/test.pdf" atomically:YES]; but for some reason when I save instead of seeing a picture of my vie (iSight Camera) I se...

Table view cell, custom editor and editing frame

Hi! I am using a custom editor when editing the contents of a cell inside a Table view. From the docs I see that the custom editor has to be an NSTextView. So I put the text view in the document view, then I referenced it from the cell subclass through an IBOutlet in order to assign it as custom editor. When doing all this, I can set t...

writeToURL not working

Hello, I am trying to use NSString *myString = @"NO"; [myString writeToURL:[NSURL URLWithString:@"http://example.com/text.txt"] atomically:YES]; But am having no luck. myString is set to NO and example.com is set to the correct website. The only issue I could see would be text.txt already existing? Can writeToURL even write to http?...

How can my XCode project files be exactly the same as a working project and still have build errors?

I'm following a tutorial from chapter 12 of the book "Beginning iPhone 3 Development." When I try to build the project I get an error. The book came with the project files, so I went through every file in my Classes directory and copied and pasted the code from the example project so that they are identical. This has solved my build erro...

XCode Cocoa Console Application Linking Error

Hey guys, I made a new project in XCode (console application). Then I added a new Objective-C class and compiled it. However, it wouldn't build. Here are the errors I am seeing: Undefined symbols: "_objc_msgSendSuper", referenced from: -[Terminal init] in Terminal.o -[Terminal dealloc] in Terminal.o ".objc_class_name_NS...

How to display an NSString in NSLog

The following will compile but if run it will crash. -(void) testFunc : (NSString *)s{ NSLog(@"%@", s); } What's wrong with this code? I call the function like this: NSString *msg = @"This is a message"; [self performSelector:@selector(testFunc) withObject:msg afterDelay:0]; [msg release]; ...

Calling Objective-C methods

Let's say I have a method called foo. What's the difference between: [self foo]; and [self performSelector:@selector(foo)]; Are they the same? The first one seems so much easier, so why would you ever want to use the second one? ...

Core Animation delegate not called

I must be doing something wrong obviously. My delegate doesn't get called when I set the frame of a view. Frame version NOT working -(void)someMethod { CAAnimation *anim = [CABasicAnimation animation]; [anim setDelegate:self]; [[currentViewController view] setAnimations:[NSDictionary dictionaryWithObject:anim forKey:@"frame...

NSString Question

Hi, I'm trying to extract the names from this list: new String: blood cz TheDeAtH TBH DragonFire Scotsman King Kot BobLeeSwagger AffeMitWaffe Jackobo D L fatality Jack bobo telex apa Tiger zip Guronzan no...

cocoa : dock like window

Hello, I am looking to create a NSWindow behaving like the dock window: - Appears when the mouse cursor stays at one edge of the screen - Does not takes the focus (the app having the focus keeps it) but reveives mouse events Any idea on how I can implement this? Thanks in advance for your help, ...

[iphone] empty string, textfield

hi, if i want to check whether a textfield or string is empty i compare it with NULL or nil? thks ...

Record Sound in Cocoa Example Please!

Hi, I've been scouring both this site and the net in general for an example cocoa app that uses QTKit or Audio Queue and actually works. Unfortunately, I can't find anything that fits the above description. All I want to do is get a simple audio recording app so I can learn how it works! Please, I have put alot of time into this alre...

RTFString Containing NSASCIIStringEncoding Special Characters?

I have a string in my cocoa GUI that needs to have special formatting (fonts, colors, etc.). Naturally, I'm using an attributed string. For convenience, I Init the string as an RTF: NSString *inputString = @"This string has special characters"; NSString *rtfString = [NSString stringWithFormat:@"{@"***LENGTHY RTF FORMATTING STRING *** %@...

Implementing NSOutlineView/NSTableView with different cells (and data types) per row.

I'm wondering how one would implement an outline view like the one Xcode 3 is using for the build configuration: When using an NSOutlineView/NSTableView with bindings and an NSTreeController/NSArrayController, the view's columns get bindings assigned to, not the individual cells, for obvious reasons. If every row in a column uses the ...

applicationDidFinishLauching never invoked, WillFinishLauching does

I have a Cocoa application which works fine except it will not invoke applicationDidFinishLauching on my app delegate. applicationWillFinishLauching does work though. In IB I have set the delegate from "Application" (and also File's owner) to my "XXX App Delegate" object. All other application specific methods are called correctly weird...

How to use the same category in multiple classes?

I have stack category for NSMutableArray that I use in Class A @implementation NSMutableArray (StackUtil) - (void)push:(id)stackObject { [self addObject:stackObject]; } - (id)pop { id retVal = [[self lastObject]retain]; [self removeLastObject]; return [retVal autorelease]; } @end How do I properly include this category for fo...

Setting NSStatusItem Tooltip from a different Object

I have a NSStatusItem called statusItem created in my AppDelegate. I want to change the tooltip in the instance of NSStatusItem in a different object, but don't know how to do so since I'm still getting the hang of the Objective C language coming from Basic. How should I implement this? ...

GET http request method after redirect when using nsurlconnection SynchronousRequest

Setting NSMutableURLRequest with setHTTPMethod:@"HEAD", as i only want the HEAD information, and using NSURLConnection with sendSynchronousRequest, as i need the thread to block until the info is retrieved, all works well until URL redirect occurs. It appears that synchronousRequest uses a GET request after it encounters a redirect and d...

XCode Cocoa Console Application Import Error

Hey guys, I made a new Console Application Project in XCode, and in the main.c file, I tried to Import Cocoa.h and another header file that I made. However, XCode started freaking out and gave me a bunch of errors. All of the errors were Parse Issues and came from NSObjCRuntime.h, NSZone.h, and NSObject.h. Anyone know why? Thanks! ...

Display icon and text in same cell of NSTableView

I would like to display an icon next to a text item in an single cell of a table view. An example of what I want to achieve is the application list in System Preferences -> User Accounts -> Login Items. What's a good way? ...