objective-c

Load image from url in iPhone, only if small

I'm using initWithContentsOfURL of NSData to load an image from a url. However, I don't know the size of the image beforehand, and I would like to the connection to stop or fail if the response exceeds a certain size. Is there a way to do this in iPhone 3.0? Thanks in advance. ...

Similar function to GetLastError in objective-C/C?

I'm doing some lovely socket programming in objective-C right now and part of my code is giving me an error (in the setsockopt method call). I was wondering if anyone knows of a similar function to the GetLastError() function in C++ that I could use in objective-C to determine the problem with my code? ...

iPhone OpenGL fps test

Anyone can tell me how to get and display the fps (frame rate) of a running program on screen? ...

NSOutlineView and NSTreeController example

Hi Everyone, Please send me some links on how to use NSOutlineView with NSTreeController bindings without using core data. Thanks in Advance, BP ...

Cocoa Touch - UISearchBar Keyboard - Hide 'Search' Button

Hi all, On my iPhone app I'm using a UISearchBar (without a Search Display Controller). I have my own 'Search' button as a UIButton and therefore on the keyboard that pops up when editing begins on a UISearchBar I would like to constantly hide the 'Search' button on it as it is unusable. How could I go about doing this without the Searc...

RetainCount question using nested UIViews in iPhone app

I've made a test iPhone app to try and understand why I may be leaking memory in some other projects. I'm also a newbie when it comes to Obj-C/iPhone. Basically the view controller creates 5 randomly colored boxes which are themselves sub-classed UIViews. double-Clicking on any of these boxes fires off a notification to the view contro...

Using the Twitter API within iPhone application

Hello I want to integrate Twitter API into my iphone application. I have read about JSON framework with iPhone SDK 2.2. But I am new to this type of application. Can anybody please explain how to integrate this Twitter's APIs with my application and how to use it. Also tell me how to open "svn checkout http://json-framework.googlecode.co...

Mapping obj-c object to sqlite database

Hello Im looking for a simple (if I can call it that) mapping tool for obj-c, that maps objects and their relationships to a sqlite database. Is there any out there that acts like db4o for java? I havent found anything on google, and I think its because Im not completly sure of where to look and what to look for. Hope someone can help, ...

Delete row uitableview problem

I am using this code...But its terminate my application some times (void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { //FeedArray is NSMutableArray if (editingStyle == UITableViewCellEditingStyleDelete) { [self.tableView beginUpdates]; [FeedArra...

Turn autolock off from an application

Users want autolock turned off while using my navigation utility. Is it possible to control autolock from an application in iPhone SDK 3.0? ...

Reload model for UITableViewController before [tableview reloadData]

This is my first try into iPhone development and I have some UITableViewControllers which will show the data returned from a webservice. In my AppDelegate I have setup a timer which is called every few seconds and reloads the model. I keep the same object reference and just refresh it's contents, so I have the same object on any UITable...

What's the RIGHT way to draw an image in the upper left corner on a mac?

I have an NSView in a ScrollView and I'm trying to draw an image in it. The problem is that I want the upper left corner of the image locked to the upper left corner of the frame, instead of the lower left corner, which is what the View wants me to do. I will need to be able to zoom in and out, and rotate. currently, I have a kludge of ...

When should you NOT use the asterisk (*) when declaring a variable in Objective C

I have just started learning objective c and the asterisk is giving me some trouble. As I look through sample code, sometime it is used when declaring a variable and sometimes it is not. What are the "rules" for when it should be used. I thought it had something to do with the data type of the variable. (asterisk needed for object data t...

Why does Xcode's autocomplete always think my properties are int?

I've been seeing this for well over a year and I can't figure out if it's a bug or I'm doing something wrong. When I declare a property in one of my classes like @property (nonatomic, retain) NSString *aString; And I go to use this somewhere else like myObject.aStr[ESC] When the list pops down with all the suggestions, aString is ...

Defining and executing simple AppleScript commands in a Cocoa app

I'm trying to add some scripting functionality to a Cocoa app that I've written. I've created an sdef (Scripting Definition File) for my project. So far I have been successful in accessing object children (elements) with AppleScript but I cannot for the life of me figure out how to call methods (commands). Here is my sdef file. <suite ...

Using NSStream to communicate with PHP?

I'm working on an iPhone project that needs to receive data from a PHP script during execution. My first thought was to use sockets/streams on either end to connect the two, but I am having trouble finding information on how to do this from the iPhone side. Has anyone been down this path that could point me towards some useful resources...

Strange graphics glitch when using flip animation.

Hey guys, I'm getting a strange error when committing a flip animation. These three bars show up, almost like strips that aren't being drawn too. I got a screenshot to show what I'm talking about. These lines are always in the same place, and show up on both sides. Here is the code that I'm using, I've used it before without problem...

Create objective-c class instance by name?

Duplicate: http://stackoverflow.com/questions/1034350/dynamic-class-creation-in-objective-c/1034368#1034368 Is it possible to create an instance of a class by name? Something like: NSString* className = @"Car"; id* p = [Magic createClassByName:className]; [p turnOnEngine]; I don't know if this is possible in objective-c but seems lik...

Problem with NSSearchPathForDirectoriesInDomains

I am trying to work directories. Unfortunately i get a non-writeable directory when I run NSSearchPathForDirectoriesInDomains. What I get is: /Users/me/Library/Application Support/iPhone Simulator/User/Documents When I run other people's examples I get: /Users/me/Library/Application Support/iPhone Simulator/User/Applications/6958D21C-...

iPhone Music App: Playing from a Cache of Notes

Hey everyone, I am working on an app that will play back notes from a 12-tone diatonic scale that spans several octaves. This will basically be a makeshift wavetable synthesizer. Times that with the number of instruments to use. The notes are stored as .wav files and will be cached into RAM to prevent overhead from hard drive retri...