objective-c

IBOutlets in Objective-C

Is everything declared within the braces following a class declaration in a header file an IBOutlet, even if you don't write IBOutlet? I notice when following some tutorials the IBOutlet word is missing for some instance variables declared within the braces, but then after the closing brace they will be defined again as a property with t...

NSDate Question

How do I create a NSDate of August 1, 2005? Found NSDateComponent on the internet, but seems too complicated. ...

Why does this chunk of code breaking up a CGColor cause a Bus Error?

Using this code causes a Bus Error. Can someone point out what is wrong with it? I'm overriding a method from CALayer. - (void) setBackgroundColor:(CGColorRef)c { float *components = (float *)CGColorGetComponents(c); [super setBackgroundColor:[LOLColors colorWithRed:components[0] green:components[1] blue:components[2] alpha:tran...

property not visible outside of interface on iPhone app

I have a view controller, which creates 2 view controllers inside it. Inside each of these child controllers I wanted to create a property, which would be public, and accessible from the parent controller. I am using the following method TableViewController.h @interface TableViewController : UITableViewController { NSInteger proj...

Getting iPhone app to display one of two different views

I have a program where we are using a navigation controller and need the app to launch to one of two different views. Basically if certain info has previously been entered then we need the app to launch to view A, but if the info has never been entered then we need it to launch to view B. I am having difficulty getting this to work and a...

alloc, init, and new in Objective-C

One book for about iPhone programming instantiates classes like this: [[Class alloc] init] Another book about Objective-C does it like this: [Class new] What's the difference? ...

Making a CALayer and all the things inside it semi-transparent?

How to make a CALayer and all the things inside it semi-transparent? That includes all the things drawn with CoreGraphics and CoreText. layer.opacity = 0.5 ...

Core Data Utility Crash

Hi, I'm working through the Core Data Utility at http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreDataUtilityTutorial/Articles/00_introduction.html#//apple_ref/doc/uid/TP40001800-CH202-TP1 I've stumbled on a rather nasty crash SIG_ABRT on the line that reads: [moc save:&error] This is the output in the debug...

NSTokenFieldCell Subclass to force use of Core Data To-Many Relationship

I have come across an interesting conundrum (of course, I could just being doing something horribly wrong). I would like an NSTokenField to "represent" a relationship in a Core Data Application. The premise is such: You click on a Note from a TableView (loaded from the Notes Array Controller). The token field is then bound (through "val...

iPhone SDK: Can I nab in instance variable from one view and access it in another?

I'm pretty new to OOP in general and just really started working with Obj-c a few months back. So, please be gentle! I appreciate your help in advance. Now to the question! I have 3 Text Fields where a user inputs name, phone, and email. I collect and place them in a label using an NSString like this [this is the one for the name]: - ...

Comparing different 'the launching Cocoa app with parameters' methods.

I found there are at least three ways to launch an app with Mac OS X from an application. NSTask. I can give parameters, but it seems that it's not for an Cocoa App, but an UNIX style binary. system function (system()) just the same way as C does. I don't know the reason why but it seems that nobody recommends this method. NSWorkspace...

"unrecognized selector" error. Cannot figure it out

I've been trying to get OAuth for Twitter to work on my iPhone application for the last couple of days, and I cannot for the life of me figure out why I'm getting this error. I've changed the way I've been approaching this for a while now, but still nothing. So I turn to SO to hopefully figure it out. The tutorial is linked here. Downlo...

What's the best way to move from developing Cocoa apps to Cocoa games?

I've created several Cocoa applications now, but I'm unsure of basic concepts of game development. I've written apps using very few custom interface elements and only very simple graphics work, and I'm looking to write a pretty basic 2D game to get started (but in realtime, not checkers or something (which I think I could handle already ...

arguments by reference in objective-c?

Hi, I'm trying to pass a nsstring by reference but it doesn't work. this is the function: +(void)fileName:(NSString *) file { file = @"folder_b"; } and this is the call: NSString *file; [function fileName:file]; nslog(@"%@",file); // and there is nothing in the string.... What I must do to pass my string byref. ...

UIKit.h and Foundation.h in Objective-C

If you import UIKit.h does that also automatically import Foundation.h? ...

How to implement the folder tree in the left of finder?

I just like to implement a function : Develope a app , and have a outline view, which have a folder and file tree just like Finder or a app called PathFinder , how to implement it ? Thank you very much! ...

Adding NSMutableArray to NSMutableDictionary and the arrays are null?

I've got a simple object "post" that has two NSMutableArrays as properties. One is for "image" objects and the other is for "video" objects. At some point in the lifecycle of "post", I ask it for a dictionary representation of itself. NSMutableDictionary *postDict = [post getDictionary]; -(NSMutableDictionary *)getDictionary{ NS...

How to implement play or pause a flash?

I used a webkit to show a flash , but now I want to add a play button and control the flash , How to do ? thank you very much! ...

How can i go from a mapview to a simple view

I am working on an app in which the starting point is a map and it has a button too. What i want is that if user clicks the button it will take him to another view which just have two or three buttons or other elements. Please provide me with detail answer so that i would be able to do it. Thanks in advance, i would really appreciate i...

How to use NSWorkspace launchApplicationAtURL?

I tried to run equivalent of "TextMate foo.txt" using launchApplicationAtURL. The name of binary is "TextMate", and I have one parameter. I tried the following code, but it doesn't seem to work. // find the textmate NSURL * bURL = [[NSWorkspace sharedWorkspace] URLForApplicationWithBundleIdentifier:@"com.macromates.textmate"]; NSWork...