objective-c

Use arguments as variable names in objective-c

Hi, I'm new at objective-c and stuck with a problem. Is it possible to take an argument of a function to use as some variable names? For example, say I have a bunch of image: aPic1, aPic2, bPic1, bPic2, cPic1, cPic2, and I want to create an action so that every time when a button is clicked, the view controller will hide Pic1 and displ...

get all methods of an objective-c class or instance?

In Objective-C i can test wether a given class or instance responds to certain selectors. But how can query a class or instance for all its methods or properties of a class (e.g. a list of all methods or properties)? Wether documented or not, it has to be possible as e.g. WebView can query a plugins scriptable object for all methods and...

How to set a default value to a UITextField when the application is loaded?

Hi, I'm a Objective-C newbie and I'm currently trying to build an app which has a UITextField (called "initial_dose") and I'm wondering how can I set a default value which will be visible straight after the application is loaded. I kind of know how to set the value but not sure WHERE I need to call this? initial_dose.text = "@myInitia...

iPhone SDK: Forcing landscape mode for a single part of an app

Yet another landscape mode question. We've all seen the [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO]; Nonsense. I have not been able to get this to work on the simulator or on the device. What I get is this: http://i47.tinypic.com/zl9egh.png when I really want this: h...

Core Data - Backing up to Google App Engine (iPhone)

I am considering backing up data from an iPhone application using the Google App Engine (GAE) - I was also considering using Python to build a RESTful app to deal with incoming/outgoing data. On the client side I am using Core Data to store the information I wish to back up, and retrieve using the GAE. I was wondering whether there we...

Detect UISearchBar focus on the text field

Is there a way to detect if a user has click on the searchbar textfield and the keyboard has appear ? ...

Doing something wrong with bindings, can't find out what

Hi, I've a mutable array that holds instances of a model object. That model object has several properties one being "name". I have no problems initialising or populating the mutable array. I've a window with a drawer. I added a table to the drawer, the idea being that the drawer would use the table to display several instances of the m...

Measuring Human-Flatulence Propagating Wave Packet on the iPhone

Using my iPhone, I would like to measure human flatulence in order to measure, quantify, and provide a statistical report based on various properties of the overall event quality. Outrageous, maybe. Fun, definitely. If I'm going to "release" an iPhone app, I want to do it in style. That's right, I want to measure farts/stinkers/toots. ...

What do the plus and minus signs mean in Objective C next to a method?

I am very new in objective c and in xcode. I would like to know that what are the + and - signs next to a method definition mean. - (void)loadPluginsAtPath:(NSString*)pluginPath errors:(NSArray **)errors; ...

Is multiple assignment a hack in Obj-C?

So, I've got a class (IKImageView) with a bunch of properties. I know that view setProp: BOOL returns void. However: BOOL b = view.prop = NO; seems to work. If I had a function f() that returns a boolean, does anyone know if this is really doing: [view setProp:f()]; Bool b = [view getProp]; or [view setProp: f()]; Bool b = f(); ...

Xcode does not recognise methods added through categories

I've created a category to add methods to NSManagedObjectModel. Everything works fine except Xcode keeps throwing warnings about NSManagedObjectModel not implementing the methods. How can I force it to recognise the method? ...

What Objective-C knowledge should I have?

I am finding this What Ruby knowledge should I have? thread so useful as I try to get to grips with Ruby I keep going back to it over and over. Its been a real help to guide me into writing decent Ruby code. I have over the past few months been struggling to get to grips with Objective-C, writing all sorts of messy bits. Its occurred to...

Retain counts of IBOutlets

While coding always the same questions concerning retain counts of IBOutlets came along: Retain count after unarchiving an object from NIB? When to use @property's for an IBOutlet? Retain or assign while setting? Differences between Mac and iPhone? So I read The Nib Object Life Cycle from Apple's documentation. Some test apps on Mac and...

Simple way to separate UITableview datasource and delegate from main UIViewController class?

The typical UITableView usage pattern is to have the main UIViewController become a target datasource and delegate for the UITableView it is holding on to. Are there any simple and easy to follow tutorials that would help me figure out how to move the code that pertains to the UITableViewDelegate and UITableViewDataSource methods into a...

Embedding version control within App

I am building an application to learn cocoa, basically its a notes keeping app. But i wanted to build a functionality where i can see what happen to the document over time, i think using subversion/version control software can help me in this task. But how i can embed it within an app? ...

Embeding a Web Server in a Cocoa Application

I want to embed a simple web server into a cocoa application that can support dynamic operations, like processing form submissions. It should all be contained in the app. My first thought would be to include a Rails server, but something about that seemed wrong. Are there any examples of people integrating a web server in their app? ...

Function syntax in Objective-C

Do all functions (as opposed to class/instance methods) in Objective-C use C syntax for both declaration and calling? ...

Why can I fill my NSArray just with one object?

Hello, why can´t I fill my NSArray? Where is my mistake? He always just fill one object/image to the nsarray. I set a NSlog to check which value string has and he shows me all the 20 urls. for (int i = 0, count = [bild count]; i < count; i = i++) { NSString * string = [bild objectAtIndex:i]; NSURL *url = [NSURL URLWithString:str...

How to maintain data across object instances in Objective-C?

I've had some experience developing for the iPhone but am entirely self taught and am trying to improve my practices. This is a question that is probably pretty introductory to programming. What is the best way (or is it possible) to maintain instance variables with values that are common to all instances of an object? Is it possible to...

Storing callbacks in a dictionary (Objective C for the iPhone)

I am trying to store callbacks in a dictionary. I can't use blocks as the iPhone doesn't support this (unless you use plblocks). I tried using functions, but apparently NSMutableDictionary doesn't allow these pointers (wants an id) I tried using class methods, but I couldn't find a way to obtain a pointer to these I could try using fun...