cocoa

Cocoa Touch: How to have a controller always visible over other views

I'm relatively new to Cocoa programming, but I've managed to figure a fair amount out. One thing I haven't been able to figure out yet is how to have an element that is visible over all views. Like a volume control that is always visible just above the tab bar at the bottom of the screen. How should I go about doing that? ...

Does UIGestureRecognizer work on a UIWebView?

I am attempting to get a UIGestureRecognizer working with a UIWebview which is a subview of a UIScrollView. This sounds odd but when I have the numberOfTouchesRequired set to 2 the selector fires, but when numberOfTouchesRequired is set to one the selector doesn't fire. Here is my code: UITapGestureRecognizer *tap1 = [[UITapGestureReco...

Extract known pattern substring from NSString (without regex)

I'm really tempted to drop RegexKit (or my own libpcre wrapper) into my project in order to do this, but before I do that I want to know how Cocoa developers manage to do half of this basic stuff without really convoluted code or without linking with RegexKit or another regular expression library. I find it gobsmacking that Cocoa does n...

Network Connection NSNotification for OSX?

I simply need to have a notification post when a valid IP address is assigned. I have tried polling via SCReachability, but that seems to be inefficient. Any suggestions? This seems like it should be simple, but I've been struggling for several hours to get anything working. ...

Cocoa Objective c : Auto Generate form

Hello, Is there a way i can generate form with TextField, Combo box etc in COCOA? We have certain data and i would like to generate form using given data. Thank you ...

Keyboard layout change in cocoa application

Hi , I'm a newbie, I'm trying to learn objective-c.I have developed a small application which accepts user input and saves it in sqllite. Curently my application supports only english keyboard layout. I have put radiobutton with options English and Danish. On option select the keyboard layout should change to desired on and accept the i...

Optimize a views drawing code

Hi, in a simple drawing application I have a model which has a NSMutableArray curvedPaths holding all the lines the user has drawn. A line itself is also a NSMutableArray, containing the point objects. As I draw curved NSBezier paths, my point array has the following structure: linePoint, controlPoint, controlPoint, linePoint, controlPo...

New tab in Safari window from Cocoa and Scripting Bridge

I'm trying to create a new tab in a Safari window from Cocoa using Scripting Bridge. My code looks something like this: SafariApplication *safari = [SBApplication applicationWithBundleIdentifier:@"com.apple.Safari"]; if ([[safari windows] count] == 0) { NSLog(@"No window found. Creating a new one."); ...

Programmatically closing an NSPreferencePane OR detecting when it was loaded again

Hello! In the "mainViewDidLoad" of my NSPreferencePane, I am prompting the user to accept the license and on-user-reject, I would like to close the window. I was hoping that the [NSApplication terminate] would work; and it does! The logic returns from that point in code and we're back at the System Preference Pane window. Just that if t...

Are there any useful naming conventions for *your* constant/static variable in Cocoa?

I know that constants start with the k prefix, but does anyone have their own constant prefix, so they can easily get completion on their constants, instead of Apple's? I use a three letter prefix for my classes because of my company name, let's pretend it's OMG. I tried prefixing my constants with omgkConstantName but that isn't very s...

iPhone SDK: Bonjour & NSNetService name != published name?

In my iPhone app, I'm publishing a bonjour service and using the following delegate method: - (void)netServiceDidPublish:(NSNetService *)ns { NSLog(@"Bonjour Service Published: http://%@.%@", [ns name], [ns domain]); } The "name" property is returning the device name, "How's Testing", which is correct. However, when I use Safari to...

iPhone – Best method to import/drawing UI graphic elements? CGContextDrawPDFPage?

Hello, What is the best way to use the custom UI graphics on the iPhone? I have come across CGContextDrawPDFPage and Panic's Shrinkit. Should I be using PDF's to store my vector ui graphics and loading them using CGContextDrawPDFPage to draw them. Previously I asked what way Apple store their UI graphics and was answered crushed png....

Genertate random color hex in Objective-C ?

How do I generate a random color hexadecimal in Objective-C ? I need a color hexdecimal , I don't need a random color. It is complicated ... ...

Cocoa - Is there a way to check on whether not a cache exists for a NSURLConnection?

I would like to be able to log monitor/log when a local machine cache is being used or when the data is being drawn from the remote source. is there a NSURLConnection.cacheExists method? Or better still one that shows the expiration date or other cache details? ...

NSURLConnection connectionWithRequest blocks interface

Hi all. I thought the reason behind having asynchronous requests is to have it run in the background? Well, I'm uploading something using NSURLConnection connectionWithRequest, it all works fine. The only thing is, it results in the Beach Ball of Death and the user interface becomes unusable. Of course there's the possibility to run it ...

NSUndoManager won't undo editing of a NSMutableDictionary

Hi, I'm experiencing problems with the undo operation. The following code won't undo an removeObjectForKey: operation but the redo operation setObject:ForKey: works. - (void) insertIntoDictionary:(NSBezierPath *)thePath { [[[window undoManager] prepareWithInvocationTarget:self] removeFromDictionary:thePath]; if(![[window undoManage...

simulating a click on cell that contains an nspopupbutton (populated with bindings) in an nstableview

I've got an application that needs to run on os x 10.6 and 10.5; there is an NSTableView that contains an NSPopUpButtonCell that is populated using an array controller. When a new item is created in the table I need to pop up the menu for the row entry automatically. I was using the method performClickOnCellAtColumn:row: which produces...

How hard is it for a .NET programmer to learn Objective C and Cocoa?

Hi, I'm trying to build a dual platform application for a company of my own I'm trying to start at night. I have the .NET version done, but have not finished the UI part. I'm thinking of buying some 3rd party controls. If I buy these controls, however, they clearly will only work in my Windows version. I'm wondering if I should try ...

Nstableview group style for nsoutlineview

I like the look of the group rows in the nstableview. In apple mail, the group sections like mailboxes and rss with that style too. Is there an easy way to make a group row or root item in an nsoutlineview to look like that? I think I have to override the willDisplayCell method... ...

Download file with progress bar in cocoa?

Hello, I need to have a progress bar that responds to the percent complete of a download in cocoa. I think this might use things like NSProgressindicator and possibly NSTask. I'm not sure if theres an "official" method to download file in cocoa because up until now I just used curl with NSTask. Thanks for any replies. ...