objective-c

NSShadow with a NSButton subclass

Here's My Code: - (void)drawRect:(NSRect)dirtyRect { // Drawing code here. // Create the Gradient NSGradient *fillGradient = nil; if (mouseIsDown) fillGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.868 green:0.873 blue:0.868 alpha:1.000] endingColor:[NSColor colorWithCali...

Is a file available to be opened?

Short version: I think I'm asking for a file too soon, but it's pretending like it's ready. Am I missing something? Slightly longer version: I am writing files to disk. Before I do so, I have the user add some meta data, including the new file name. Once the user is done, the screen goes away and the program writes the file to disk. The...

iPhone NSURLConnection: What to do with returned NSData Object? Google Docs API

I'm working with the Google Docs API in my iPhone application. I've sent the proper POST request, and received a response along with some NSData. If I NSLog the NSData object, I get this: NSData *returnedData = [NSURLConnection sendSynchronousRequest:request returningResponse:theResponse error:NULL]; NSLog(@"%@",returnedData); //outpu...

"prefetch" HTML for UIWebView and pass it to a new controller

I have a navigation-based application with 2 UIViewControllers (controller-2 is pushed onto controller-1 when the user selects a particular row within a UITableView displayed using controller-1). Here's the 'twist'… When controller-1 is loaded, I want to "prefetch" a URL containing HTML/javascript into a UIWebView. Initially, the user ...

Custom UITableView (UIView + Cells)

Hi, I already created a UIViewController, where I display text, picture and other information. Now I wanna be able to put somes cells (so a tableView) under this View. What is the best way to do that? Do I have to create a UITableView and create an header with my picture, text.. or other possibility Best Regards, ...

Provisioning profile expiration

I have face a problem that all my app in my iphone is not working from 22 dec 2009, when we open app in iphone the show a error of provisioning profile is expired but i check all my provisioning profile in iphone developer program portal they show all are active. I can not find out that problem if any body know that problem help me. ...

[iPhone,Obj-C] What is "self" and how was the "view" property used?

In this: -(IBAction)buttonClick: (id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Fo Sho?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"fo sho" otherButtonTitles:nil]; [actionSheet showInView:self.view]; } A U...

Giving an NSTextView some padding/a margin.

How would I give a NSTextView some padding/a margin to the left? I know how you do it in a NSTextField (by subclassing NSTextFieldCell) but how do you do it in a NSTextView? EDIT: A bit more info: 1. The Text View just has plain text no rich text and no other fancy stuff like a proper text editor (e.g Paragraph insets). 2. Is it possibl...

UIButton Programmatically (SetImage content Adjustement)

Hi, I have a simple button and I want to put an image inside, so I have this code: myButton = [[UIButton alloc] initWithFrame:CGRectMake(20, 13, 116, 138)]; UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[self.visuel lpath] ofType:@"jpg"]]; [myButton setImage:image forState:UIControlStateNorm...

How we set or get focus to any control - and leave the focus in Cocoa

Hi All How we set or get focus on any control in cocoa. like setfirstresponder We have 2 control A and B, A is firstresponder After action I want to set focus ob B control and also how we get focus on a particular control and how we notify that leave focus..... I need it in validation .... I want to force user to fill a textfield and...

How do you design an interface with a list of varying width elements?

I want the interface to look something like the right side of the Things interface but the items in the list need to be of different widths. Is this achievable with the Interface Builder or do I have to use drawing? I'd like as detailed an explanation as possible. Thanks! Like this : ...

load a tabBar view before entering it

hello, i have two tabBar's, is there a way to load and by so prepare the view (it's an xml view) of the other tab while the user still didn't enter it (for faster loading) ? ...

How to update a section of an NSView without redrawing the whole view.

I have a NSView where I draw thousands of NSBezierPaths. I would like to highlight (change fill color) the a selected one on mousemoved event. At the moment I use in mouseMoved function the following command: [self setsetNeedsDisplay:YES]; that force a call to drawRect to redraw every path. I would like to redraw only the selecte...

A method that takes both NSArray and NSMutableArray

I want to create a method that can take an NSMutableArray or an NSArray object. I think I can just use (id) as the parameter type... or convert the NSArray to NSMutableArray before passing. However I'm not really happy with these solutions. In other languages I might pass an IList or some shared object that they both inherit from... ...

Objective-C/Cocoa tutorial for internet capable application?

I've done a bit of iPhone programming (even have 1 published app) but what I'm really interested in doing is learning to create applications for OS X. I'm a 7 year .Net Developer so I have some understanding of how to make desktop applications, though I don't know much about memory management as .Net spoiled me. I was hoping someone coul...

How to code recursion in Objective-C with classes?

Hello all! I just started learning Objective-C and OOP ... so I have very stupid question :) I wanna understand how to write recursive functions in Objective-C. I get factorial counting as example. Here is my code )) he-he #import <Foundation/Foundation.h> @interface Factorial : NSObject { int nFact; } -(int) countFactorial:(in...

Checkbox State Problem

Hello, I'm new to Cocoa, and working my way through Hillegass's book. I'm having trouble with chapter 20's challenge 2. The challenge is to add checkbox's that toggle if the letter being drawn is italic, bold, or both. -(IBAction)toggleItalic:(id)sender { int state = [italicBox state]; NSLog(@"state %d", state); if (state = 1) { i...

How does one set SSL ciphers when using CFSocket/CFStream in Cocoa?

I recently needed to configure CocoaHttpServer, which we're using in our application with success, to handle HTTPS connections coming from a client application (running on Android devices). This is fine - there is copious sample code which allows for this, and we were able to enable the secure server without issue. In practice we were s...

Objective C communication between classes

Hi All. I have an AppController class that looks after view/control in my app in the usual way. There's a button on my app's main window in IB that causes AppController to instantiate a new window controller (accountPanelController) and show that secondary window: - (IBAction) showAccountPanel:(id) sender { //Is accountController ...

[iPhone Obj-C] How to create "otherButtonTitles"?

I have the AlertView working perfectly with a "cancelButtonTitle:@"Cancel"" and "otherButtonTitles:nil". My question is how to get other buttons. When I only change the "otherButtonTitles:@"2nd Button"", then the iPhone simulator just crashes out of the app and into the homescreen. ...