objective-c

Is a synthesized property already alloc/init -ed?

If I have a custom NSObject class called ProgramModel, does it get alloc/init -ed when I @property and @synthesize it from another class? For instance, in a ProgramController class like this // ProgramController.h #import "ProgramModel.h" @interface ProgramController : UIViewController { ProgramModel *programModel; } @property (nona...

Is it possible to return a class (but not an instance of a class) in Objective-C?

Hi - relatively new programmer here. Look at the two classes defined below. I'd like to be able to call the following: [instanceOfSecondClass transitionToPage: [instanceOfFirstClass nextPage]]; However, that doesn't seem to work (because I'm trying to return a class, not an instance of a class.) @implementation FirstClass - (id)next...

Do I need two NSObjectControllers?

Hi, I'm learning about Cocoa bindings. I'm having two completely different objects, each with an iVar that I want to sync with a user interface item. But since they're two different objects and I can only have on "content" outlet with one NSObjectController, do I need another one? ...

QuickLook plugin displaying an image and some infos.

Hey there, I'm currently writing a QuickLook plugin, and I wondering how I can display an image and some information about that image at the same time, similar to http://www.code-line.com/software/sneakpeekphoto/ . ...

Importing into .h versus .m

Is there a difference between importing something (e.g. #import "JSON.h") into the header file versus the implementation file? ...

how to run sql script file in sqlite3 through objective-C

Hi all, Here is my question, when interacting with Sqlite 3 through terminal, you can execute SQL statements stored in a txt file by executing this command: .read filename Is there a way to do such thing through Obj-C code? i.e. I've got a sqlite3 db file connected in the code, and i'd like to run a script file programmatically. Th...

Post to Twitter issue

I am making an iPhone application where you can submit your score to Twitter to share it (as a status update) currently using this code: NSString *twitterURL = [NSString stringWithFormat:@"http://twitter.com/?status=My%20score%%20is:%%20%i%%20and%%20CharsPerMin%%20is:%%20%@", currentScore, charPerMin.text]; [[UIApplication sharedAppli...

custom UIButton image on iPhone 2G

Hello, I have a custom UIButton with a png inside it. I have quite a few of them in my app and everywhere they seem to be working fine. In one location they are inside a UIView that is a headerView for a UITableview. Whenever I press on them, only on iPhone 2G the image box goes black while the rest of the UIButton (it's got a title....

iPhone: Fast enumeration, not fast enough?

I am trying to loop through an NSSet that has about 6500 items in it. I am using: for (id Location in sortedArray) { loc = [sortedArray objectAtIndex:i]; cord = [cord stringByAppendingString:[NSString stringWithFormat:@"%f,%f ",[loc.longitude doubleValue],[loc.latitude doubleValue]]]; i++; } ...

Making OpenFlow work vertically like a Rolodex

I've been looking at integrating the OpenFlow API developed by Alex Fajkowski: http://fajkowski.com/blog/2009/08/02/openflow-a-coverflow-api-replacement-for-the-iphone/ into an app I am working on. Does anyone know how I can stack the images vertically so that I can scroll the images from top to bottom/bottom to top like a rolodex? The...

How to upload a file to server on objective C?

Hi, everyone, I want to ask a question about the objective C. I have create a .csv file and I want to upload to a server. However, I have no idea on how to do it. Can anyone provide any example or library for me to do? Thank you very much. ...

AVPlayer and iPod asset URLs.

Does ANYONE know if AVPlayer supports playing AVURLAssets init'd with iPod asset URLs (MPMediaItemPropertyAssetURL). Docs imply yes bit can't get it working. ...

retrieving doubles in NSMutableArray converted with [NSNumber numberWithDouble:doubleVar]

I am looking for what is probably a simple answer to my novice question. I know that NSMutableArray can only hold objects, so when I put the double into the array I used the [myArray addObject:[NSNumber numberWithDouble:aValue]]; conversion method. What I need to do now is to pull the values out as doubles and average them. I believe...

Turn square image into round rect button with shine [Objective C]

In this picture you will see several TV show images that have been put into a rounded rect button with the same gloss/shine that an iphone app button usually has. In one of the icons you even see a ribbon saying "On air". I'm wondering; how do you replicate this effect? My guess is the programmer masked an image on top of the square...

memory management on the iPhone with viewDidUnload

If you set a property to nil in viewDidUnload do you need to release it again in dealloc? ...

Dismiss modal view controller on application exit

I have a view controller (view A) presenting a modal view (B) when the user pushed a button and the view B has itself a button to present view C. My problem is that if the user exits the application when the view B or C is shown, the same view will appear next time the application is launched. Is there a way to dismiss the views B and C...

Is there a way to do rotation in UIViewController without animation?

Is there a way to enable rotation but without the animation as you turn the device from portrait to landscape? I'm looking at: - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration ... but I don't see how I can set the "duration" property to 0 and thus elimi...

Is it possible to refresh the TabbarController when a user selects a particular tab in iPhone?

Hi Everybody, I have a TabbarController with 3 tabs with each tab representing a navigation Controller. What I would like to do is when a user selects a particular tab the whole tabbar Controller should refresh. To make it more clear... When a user selects tab0 and navigates in that tab 2-3 times and then the user selects tab1. Now wh...

UINavigationController problem in my iphone app?

Hi, I have created UITabbarController for my app, for every tabbar have individual viewControllers, which i have changed it as navigationController, The first tabbar, i have placed UIScrollview and place some of the objects on scrollview, I was not able to access navigation controller inside of view placed on scrollview, please help me ...

Objective-C Sort NSMutableArray of Objects by a specific Object attribute

I have an object called Station in my system with these attributes: @interface Station : NSObject { NSString *stationID; NSString *callsign; NSString *stationState; } I also have an NSMutableArray containing 20 'Station' objects as defined above. I need to define a method which can can sort this array in 2 ways: 1) By stationID 2) By...