objective-c

Custom uitableview cell issue

I have a custom UITableViewCell as such: @implementation CellWithThreeSubtitles @synthesize title, subTitle1, subTitle2, subTitle3; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.textLabel.backgroun...

Ipad landscape splash won't show

I'm trying to set a Landscape splash for my iPad app but it's not working. I currently have a Default-Landscape.png and a Default-Portrait.png. I added the four orientation in my plist file and still nothing. It works if I launch in portrait, but if I launch in Landscape the screen stay black until my app start. Is there anything els...

When are iOS keychain items removed?

I could have sworn this worked differently in previous versions of iOS, but as of iOS 4.0 it looks like my app's keychain items are not removed when the app is removed. However, it looks like some are cleared when the app is upgraded without first removing? Can someone provide a clear explanation of when iOS keychain items are removed? ...

objective c finding pixel width of a string

I have a UIButton of fixed width and I want to place text in it. Since the size of the String is unknown in advance, I will have to resize the font as I read the String from a flat file. How can I do that? A function similar to the following will be great: UIFont resizeFontAs:(UIFont)initialFont andStringAs:(NSString*)string andWidthA...

Make my Cocoa app respond to the keyboard play/pause key?

Is there a way to make my app respond to the play/pause button on Mac? EDIT: Using the suggested code,I get this console message: Could not connect the action buttonPressed: to target of class NSApplication Why would that be? ...

Custom OSX window skin?

How do I make custom buttons for my app window on OSX? I'd also like to skin the entire window. Are there any easy classes or ways to do this? Any tutorials that show how? ...

Sharing variables - objective-c

Here is my code: PtyView *v = [[PtyView alloc] init]; [v sendData([charlieImputText stringValue])]; in the PtyView.m file I have this: void sendData(NSString *data) { NSRunAlertPanel(@"",data,@"",@"",@""); //used for testing } But for some reason, the code errors: saying that PtyView may not respond to sendData, and I know that the...

Multiple superclasses in Objective-C?

Can I inherit from multiple classes in Objective-C? (If yes, how so?) ...

(UIApplication *) Why is there a space before the asterisk? Thanks

-(void)applicationDidFinishLaunching:(UIApplication *) app { after UIApplication why is there a space before the asterisk? thanks all. ...

Globally hiding cursor (from background app)

I want to hide the cursor from a statusbar app and i've done some research. It seems as though the solution to this problem was found a while ago: http://stackoverflow.com/questions/1412084 or http://lists.apple.com/archives/carbon-dev/2006/Jan/msg00555.html But the code that is referred to will not compile. Do any of you guys know eit...

iphone: is this a correct design: 2 views with 1 class ?

Hi guys, i' a new iphone developer coming from flash stuff. let me tell you about my problem: i'm doing a puzzle game and have a tab bar controller with 4 tabs. i use 1 tab for sign up and other for login, they works different but uses a lot of the same code (displaying images, playing sounds, settings stuff, audio things, animation...

iPhone SDK Background threads calling other methods

Hi all, I am a seemingly straightforward question that I can't seem to find an answer to (and it is hindering my app). I have a background thread running a paricular method: -(void)processImage:(UIImage *)image { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; //Process image here in the background here [pool dra...

Why would my app not be able to "attach" an action?

I've changed my app class type from NSObject to NSApplication and now I get the following message when testing my app: Could not connect the action buttonClicked: to target of class NSApplication What does this mean and how can I fix it? ...

in scripting bridge how can i send shortcut with 2 modifiers ?

I was trying to replicate "take a screenshot shortcut" (cmd+shift+3) via cocoa and scripting bridge SystemEventsApplication * sysEvent = [SBApplication applicationWithBundleIdentifier:@"com.apple.systemevents"]; [sysEvent keyCode:20 using:SystemEventsEMdsCommandDown]; but i can't send more than one SystemEventsEMds to the method. In a...

Using va_list and getting EXC_BAD_ACCESS

Similar to how NSLog takes variable argument list, I want to create my own method. I have my method declared like this but when I try to access the 'args' variable, I get an EXEC_BAD_ACCESS. What is that I'm not doing correctly here? - (void)info:(NSString *)formatString, ... { va_list args; va_start(args, formatString); ...

NSWindowController view window

Hey guys, I have some questions about NSWindowController. I have a subclass of NSWindowController that has its own nib. I have another class that has an event that shows the window and loads it like so. if (!propertiesController){ propertiesController = [[WorldPropertiesController alloc] init]; } [propertiesController showWindow:sel...

How do I resize a cell in a tableview with grouped cells

I am using a grouped tableview and need to resize 1 cell where the enclosed cell.detailTextLabel has exceeded the size of the cell (i.e. about 3 lines worth). Is there any easy way for the cell to auto-size itself to it's contents or otherwise, how do I change the size of that particular cell? ...

lifetime of [NSMutableDictionary dictionaryWithCapacity:n]

I thought the object returned by NSMutableDictionary dictionaryWithCapacity: would be released when the autorelease pool in main.m is drained. Instead, when i assign this to an instance member in -init, i find the object only lasts as long as the -init call. What is managing the release of the object returned by NSMutableDictionary dict...

how to tell if an NSManagedObject is new

Hi there iPhone developer. I create a new NSManagedObject and then pass it to another view controller. how can i tell in the viewController if the passed NSManagedObject is a new one or an existing one. is there a property that i can use ? Any help will be appreciated. Thanks ...

Infinite UIScrollView for whiteboard-like app

Naturally an "infinite" UIScrollView question has been asked about before, but it always seem to be related to this sort of scenario: A scrollview with 4 card subviews on a "carousel", i.e. reaching the 4th card and then swiping in the direction of continuation would yield the 1st card again (and therefore no need to scroll backwards). ...