cocoa

Get outline for NSGlyph

Hi there! With Core Text it was possible to get the outline of a CGGlyph by CTFontCreatePathForGlyph(...). Now I'd like to port from Core Text to Cocoa's font engine, so the question is: Is there a way to get the outline for a NSGlyph? ...

Getting string from NSDictionary nested in a plist file

Hi, I am trying to get a string out of a plist file that contains a nested dictionary. This is the plist: <dict> <key>DataPoints</key> <array> <dict> <key>source</key> <string>BloomBerg</string> <key>date</key> <date>2010-01-31T14:54:13Z</date> <key>value</key> ...

Convert NSData to NSString

I am receiving a successful connection to the server and i am in my callback function: I am trying to get the name of the host and print that to my console: if(theType == kCFSocketConnectCallBack){ NSLog(@"Connection is accepted"); CFSocketNativeHandle nativeSocket = CFSocketGetNative(theSocket); uint8_t name[SO...

Can I store a custom object inside a button in Objective-C?

Hi, In winforms/C# most all UI Controls have a .Tag tag, so like myButton.Tag = myObject; where the Tag property is an 'object' type so you can basically store any type of object. How might I accomplish this in Objective-C/Cocoa? do all UI elements have something like .Tag where I can store an NSObject or something? If so, can you pleas...

Question about ivars and @property's on the iPhone

I have a question about how instance variables work and when to use the @property. Here is an example interface file I am working with @interface PackageModel : NSObject { NSString *tracking; NSString *carrier; NSString *status; NSMutableDictionary *events; // Connection ivars NSMutableData *receivedData; ...

Getting NSPopUpButton from NSMenuItem

Hi, My application uses the -validateMenuItem: method for validating menu items. But I need to validate different menu items depending on what popup's there in. I was hoping for a way to get the tag of the popup, but after looking through the docs I can't seem to find a way... any ideas? Thanks, Marcus Edit: I thought this needed som...

Display image in NSTableView

Now can I display an image in a table view. The big thing is there will be multiple data sources and each one has a different image. I'm using pubsub to get the data. Ex: data source 1 image -data -data1 data source 2 image 1 -data 2 -data 3 ...

Cocoa Webkit bug?

I have some code that gets the URL from an array and stores it as a string then uses that string to load up the URL. NSString *first = [urls objectAtIndex:[sender clickedRow]]; NSLog(@"%@", first); [[webview mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:first]]]; However, when I run this I get this error: -...

Is there a Snow Leopard compatible "sudden motion sensor" API available?

I have been using Unimotion in my application to read motion sensor values for Apple laptops, but have been unable to port the code to 10.6 64-bit. (I have also tried SMSLib and had the no luck either.) Is there any simple 10.6 compatible SMS API? If there is no alternative, I am also considering patching one of the libraries. Both U...

OpenGL pixel doubling on an NSOpenGLView

I have a 480x320 NSOpenGLView that I'd like to scale up to 960x640, but in a way that pixels appear as twice the size (and sharp). If I call [myglview setFrame:CGRectMake(0,0,960,640)]; the view scales up to the desired size, but the pixels rendered by OpenGL calls are still at the native resolution. How can I scale up the GL view,...

What are the downsides of using Python instead of Objective-C?

I know some Python and I'm really impressed by the language's ease of use. From what I've seen of Objective-C it looks a lot less pretty, but it seems to be the lingua franca for Mac OS X development (which means it has better documentation). I'm thinking about starting Mac development - will using PyObjC+Python make me a second class ...

Problems faced while customizing NSTextFieldCell

Hi all, I am trying to make cells in an outline view just like we have for users in Skype's message window. For this I created a custom class: IconNameCell.h @interface IconNameCell : NSTextFieldCell { //@private NSImage *userImage; // size (17,17) NSImage *statusIcon; // size (14,14) NSString *...

How to check the items in contextual menu in cocoa

How to check the items in contextual menu in cocoa i want to place a checkmark next to specific items I was added menu like shown below in mouseDown function, (void)mouseDown:(NSEvent *)event { NSPoint pointInView = [self convertPoint:[event locationInWindow] fromView:nil]; if (NSPointInRect(pointInView, [self shapeRect]) ) { ...

How to implement voice chat in cocoa??

Hi all, I have made a simple chat application using AsyncSocket class where client nodes can send message to each other via chat server application. I want to integrate voice chat functionality in it but I am not getting any material over net which can show me correct direction to move on. Can anyone suggest me some useful link or ide...

How to structure a very large Objective-C class?

Hi, I've a fairly complex window that is backed by a controller class that is obviously growing to meet the needs of my view window. While I believe I am sticking to proper MVC I'm still having problems managing a fairly largish controller class. How do you breakdown your objects? Maybe use Categories? For example, one category to hand...

Why is my Cocoa app using so much virtual memory?

I have written a simple Cocoa app. In Activity Monitor, it is shown to be using a lot more virtual memory than all other apps: 304.6MB. (It uses this from the get-go, so I don't think it's a memory leak/management issue). Thing like Firefox, Mail etc. are only using 30MB-60MB or so. My app is using 13MB real memory. I am using garbage c...

Initial value of a Core Data Entities properties?

Hi I have several core data entities that contains a bunch of empty NSString properties. I parse some XML and set the properties I can get a hold of and would like to set the "empty" ones to "n/a" as in "not available". So if my XML does not contain the values it sort of tidy up the Entity by giving it a "n/a" string I can test for lat...

I'm having a problem with decimalNumberBySubtracting and decimalNumberByDividingBy.

Simply put, decimalNumberBySubtracting and decimalNumberByDividingBy are not working ... at all. No errors, just messed up results. I really need to fix this but Im not getting any errors and I cant think of any other way for how to do the calculation!! Im getting numbers like: 25784969139295000000000000000000000000000000000000000...

NSDateFormatter and date conversion not working.

I am developing an app for the iPhone where I need to convert an date from an XML feed into just a HH:MM format. I have the following method that doesn't work and I have no clue what I am doing wrong. As an example, the timeToConvert string would be: "Mon, 01 Feb 2010 21:55:00 +0100" (without the quotes) The method works when the regi...

OSX: Get application windows + bounds

Is there a way to get the list of windows from another application and their bounds. E.g. using F-Script or obj-c or any other way (except AppleScript) to access the window contents of another (any other) Cocoa-based application and possibly modify it? I am talking about 1) accessing the data (as http://the.layersapp.com/ does) and 2) ...