objective-c

How do I display a button on a UIAlertView after displaying it.

Hi, im newbie developing with objc. Im working on a piece of code that installs a plugin to my application. It downloads a .zip package, uncompress it and copy some data to my sqlite database. I have a UIAlertView that shows a UIProgressView while the app is downloading and uncompressing, when it finish I add to the UIAlertView a butto...

How does one implement Snow Leopard dock-style menus?

Mac OS X Snow Leopard includes a new a new style for menus when one right-clicks the dock. How can these be implemented elsewhere, in my own program? Is it an API? An SPI? Thanks. ...

How to be notified of the Minimize button being pressed in an OSX Window?

N.B.: this relates to private (SPI) functions of the CoreGraphicServices framework. I am currently running a CGSConnection to the Windowserver as the UniversalController (with the Dock killed), and would like to know how I can be notified that a CGSWindow has had the yellow minimize blob clicked. Is there a notification event that I ca...

How can I debug a program when debugger fails.

I am debugging an Iphone program with the simulator in xCode and I have one last issue to resolve but I need help resolving it for the following reason: when it happens the program goes into debugging mode but no errors appear (no BAD ACCESS appears) and it does not show where the code fails. Putting some variables as global helps me to...

How to change style for nodes in NSOutlineView?

I am trying to figure out how to change the style for group nodes in NSOutlineView. With setSelectionHighlightStyle I can change the whole list style. But I want to change only the style for group nodes. How can I do that? ...

Hard to fix Obj-C error: expected ':' before '*' token in Xcode

I've been pretty good at fixing my Xcode Obj-C errors, but this one has me stumped: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if ([[tableList objectAtIndex:indexPath.row] isEqual:@"Standard"]) { [StandardSetupViewController *standard = [[StandardSetupViewController alloc] initWithN...

applicationWillTerminate is delayed, is there a faster method to use when quitting?

I'm using - (void)applicationWillTerminate:(NSNotification *)notification to save data when my game exits, then loading it if the user presses the load button next time around. The saving and loading work fine, but I've noticed there is some lag between when I press the home button and when the data gets saved. Whenever I exit, relaunch ...

Updating UI Elements with Controller Constructor

I have an NSSlider (slider) and an NSLabel (label) on a window. I also have a class "Controller" that updates the label whenever the slider's value is changed. The default position of the slider is 0.5, I'm trying to get is where Controller's constructor updates the label upon program launch. The following is the implementation file fo...

stringWithContentsOfUrl failing after updating to OS3.1

I have an application which has been running happily, but since I updated to OS3.1 and updated the SDK the application is failing to log onto a remote server, passing a connection string to the stringWithContentsOfUrl function. Before the update this was working fine, and if I copy the text string which is displayed on the NSLog stateme...

Tinting a grayscale NSImage (or CIImage)

I have a grayscale image which I want to use for drawing Cocoa controls. The image has various levels of gray. Where it is darkest, I want it to draw a specified tint color darkest. I want it to be transparent where the source image is white. Basically, I want to reproduce the behavior of tintColor seen in UINavigationBar on the iPhone....

Query : In UItextView, created in UItableview cell,the text moves upwards ,on click and due to which can't able to see the text.

Hi , I am creating a UItableview , in which ,in each cell,creating a UItextview.Here I am getting text in each cell.when we click in a particular row, the UItextView is created within the row,filled with the specified cell text. Now when i click on the text within UItextView,the text moves upwards and due to which we can't able to see ...

iPhone using NSURLConnection to get multipart data is not working right

It seems that there is a bug in the NSURLconnection when you are getting multipart files, didReceiveResponse doesn't get called like the docs say between each part (see this). So I think I'm going to parse all of the data that is coming in. The format is text and binary(images) does anyone know of any code already to parse the nsdata o...

can I put an objective-C selector in a struct?

I was wanting to associate a set of rectangles with corresponding actions, so I tried to do struct menuActions { CGRect rect; SEL action; }; struct menuActions someMenuRects[] = { { { { 0, 0 }, {320, 60 } }, @selector(doSomething) }, { { { 0, 60}, {320, 50 } }, @selector(doSomethingElse) }, }; but I get the error "ini...

How to scroll on UITableView

I have a UITableView that I want to scroll to the next row from the top (such as the 3rd row, then the 4th row, etc...). Is there an easy way to determine which rows in a table are being displayed? It seems like I will have to call indexPathsForVisibleRows and do a bunch of manipulation to figure out which rows are being displayed (and ...

How can I split a string without separator?

I need to split string without a separator. Here is the code.. myarray = [mystring componentsSeparatedByString:@","]; Here I used separator "," to split string, but I want to split without using a separator NSString *mystring =@"123456"; I have this value , now I want to insert that value in an array like this: array[0]=1; array[...

Convert NSArray to NSDictionary

How can I convert an NSArray to an NSDictionary, using an int field of the array's objects as key for the NSDictionary? ...

Subclassing and Casting in Objective C

I came across a strange problem today. I created a subclass of UIView and added only 1 method to the template code provided by xcode. @interface FloatView : UIView { } - (void)floatTest:(CGFloat)x; @end - (void)floatTest:(CGFloat)x { NSLog(@"float was %f", x); } Then in my appDelegate I had code like this: UIView *floatView = [[F...

UITableView editing-mode problems (iPhone SDK)

I have a tableView populated with custom tableViewCells. The cells are not subclasses, they are merely tableViewCells which have had a lot of tweaking and "subview-adding"(done in the cellForRowAtIndexPath method). The problem occurs when i tap the edit button. Have a look: PICTURE_1 I know the "delete badge" is hovering above the text...

Out of scope in KVC generated array

I'm trying to create an array of objects from a hierarchy of other objects like this: code 1: childController.names = [[NSMutableArray alloc] init]; for (Person *p in list.persons) { [childController.names addObject:p.name]; } code 2: NSMutableArray *testArray = [list.persons valueForKey:@"name"]; The first code snippet works...

Using NSFontPanel in Cocoa

I'm trying to use an NSFontPanel to allow the user to change an application-wide font setting. It's supposed to work something like this: the user clicks a button, a font panel pops up, they choose a font and a size, and their selection is persisted. The following code shows the panel: - (IBAction)showFontMenu:(id)sender { NSFontMa...