objective-c

Reading a file from a hard drive in iPhone simulator

Is it possible to read a file (from my normal file system) into a iPhone App running on the iPhone Simulator? I understand that the iPhone itself has not got a (user accessible) file system but this is simply for testing and will only ever be run in the simulator. The file will be a text file that can be edited while the application is...

What's the difference between calling self.myInstanceVariable and directly myInstanceVariable?

It's a month ago I was reading a line about that. I am not sure, but I think that if I call self.myInstanceVariable then it uses automatically getters/setters, but if I would call directly myInstanceVariable = @"Foo" for example, then I would bypass any getter/setter which would be really, really, reeeaaallly bad. Right/wrong? EDIT: I t...

Why is my UITableView not occupying the bounds of the screen?

Hey all, I'm building a UITableView programmatically without NIB files here. I'm doing something silly however, as my navigationBar shows up fine, as does my UITableView. However, the UITableView is not properly fitting onto the screen. You'll see roughly 20 pixels separating the UINavigationBar and the UITableView. I set my window's ba...

Using QTKit to capture directly to a QTMovie

Is there any way to use QTKit to capture directly to a QTMovie, without having to go to disk first? I'm trying to glue a couple of pieces of video that I've captured together (with appendSelectionFromMovie:), and waiting for the video to be written to disk and then reading them back is inefficient and dumb. ...

objective-c: how to convert an int to NSString

Hi, I am using the following code to get an alphabetic number of a first letter in a string: toupper([ my_string characterAtIndex: 0 ] ) - 'A' I need to do an inverse task - to convert an alphabetical number of a letter to a NSString. What is the best way to do so? Thank you in advance. ...

Documentation-generator for Objective-C?

Is there a generally-accepted documentation generator for Objective-C (similar to RDoc for Ruby)? I've seen Doxygen and ObjcDoc, and am wondering which is most widely used. ...

From PHP to Objective-C

Being a pretty experienced PHP developer, and having a fair knowledge of C (Wrote a distributed computing experiment with 16 of my Dad's NEC microcontrollers), I'd like to make the move to Objective-C and Cocoa, eventually aiming to integrate the Mac / iPhone apps with some of my PHP projects. Going through the "Cocoa Programming For Ma...

How to create a frame and fill it with a segmented control??

I want to create a frame and fill it with a segmented control. How would i do this??? ...

iphone: masking an image using paths

How do you mask an image using paths? What Im trying to do is draw a line using CGContextStrokePath and show only those parts of a CGLayerRef which are under it. Also, how do you erase only those parts of the CGLayerRef which are under it? Thanks. ...

Disable NSToolbar customisation via window's toolbar button?

I am looking to disable the Command + Click combination on a toolbar button (located top-right) in a Cocoa window. I would still like to let the user show and hide the toolbar, but I do not want them to be able to select a different display mode (e.g. small icons, no icons, etc). Has anyone found a way to do this? Thanks in advance. ...

How to move the cursor of a QTMovie?

I have an array of objects that have QTTime structs as attributes. The objects are in an NSArrayController which is bound to an NSTableView. I have a QTMovieView set up as an IBOutlet. I want to have it such that when an item in the NSTableView is selected the QTMovieView's cursor is moved to the time indicated in the selected objects...

How to get the file size given a path?

I have a path to file contained in an NSString. Is there a method to get its file size? ...

How do you get search capability similar to Spotlight or iTunes?

I have an NSTableView that contains a few columns that are populated with data. How do I set up a search bar that can filter the rows based on the content of a specific column? I am looking for the type of thing that is done with Spotlight in the Finder or the search bar in iTunes that can filter songs by metadata. ...

LSUIElement application that starts a window with an application menu?

Hi, I am writing an application that initially starts with just an NSStatusItem element. From its menu, the user can click a menu item that opens an NSWindow. I would like that when that window is in focus, the application menu will be displayed. Is it possible? ...

How I maintain aspect ratio for a resized window?

I have a window that contains one QTMovieView. How do I make it so that resizing of the window will keep the window's aspect ratio the same? ...

iPhone SDK 3.0 beta 4 broken, Internal Error

Final Edit: This problem is solved, after I downgraded to SDK for iPhone 2.2, then deleted all the files in the Crash Logs in the Organizer window (then upgrade back to 3.0 beta 4). Apparently there were too many of Crash Logs associated with my iPhone (like 300+). Thanks you guys for insights! Original problem: After I update my iPhone...

How to make part of an NSSlider stop at tick marks?

I'd like to have an NSSlider that doesn't snap to tick points, except of the last two. This is the same behavior of the slider in System Preferences -> Energy Saver -> Computer Sleep. Any ideas on how to do this? ...

Is it possible to use Core Animation to fade out a UIBarButtonItem?

Hey everyone, I'm curious, is it possible to somehow intertwine Core Animation to give a "fade out" of a UIBarButtonItem? I have a tableView which I represent with two different data sources. Once a particular data source gets triggered, I'd like to fade out the current UIToolBar options and fade in new ones. Thanks for pointing me in ...

iPhone development question: Populating table view

I need help, I need to populate a tableview with objects from my array... I may be using some methods from mac code (lol). I just need some help. Here is my header and implementation files, thanks. #import <UIKit/UIKit.h> @interface Chuck_FactsViewController : UIViewController { IBOutlet UITableView *tableView; NSMutableArray *chuckJo...

optimising CGLayer drawRect method

I'm currently using CGContextDrawLayerInRect to draw a CGLayer in drawRect. This is called quite often. Is there any way to lessen the overhead by drawing only that part of the CGLayer which has changed instead of the whole CGLayer in drawRect? -(void)drawRect:(CGRect)rect { CGContextRef currentContext = UIGraphicsGetCurrentContext(...