objective-c

Common NSNotification mistakes?

A simplification... A building has an array of apartment objects. Each apartment has a single currentTenant. These tenants are of type Person. Note that currentTenant doesn't have a reference to the apartment, so can't send information back up the chain. When a tenant has a plumbing issue he raises an NSNotification: [nc postNotifi...

Is there an equivalent of Mac OS X "open" command that can be called from C++/Objective-C code?

On Mac OS X there is a very useful "open" command which launches an application suitable for opened file type. Is there some C++/Objective-C function on Mac which does the same? Note: I know I could launch an "open" process. I'm just not sure if it's the best option. ...

stop user changing tabs till app loads fully

Hi guys, im my app i have had to thread the loading of xml so the app loads and does not get kicked out by the os , but that also means that when the app loads and , the user selects one of the tabs that is still loading, it crashes. is there any way i can stop them changing tabs till the app is fully loaded? Thanks ...

UITAbleView not in alphabetical order?iPhone

I have a tableView with several Sections being populated from a plist of NSDictionaries How do I have it arrange the sections in the order they are in in the NSDictionary instead of alphabetically? ...

Buttons on top of UIPopoverController

Hi, I want to add two Buttons on top of UIPopoverController like it is shown in following screenshots: HTML Edit Thanks for helping me! ...

Use a UITextVIew

Hello, I wanted to post some text in a UITextVIew. I wanted the user inserisse. As messages tomore be inserted into a queue to another as in a chat. How can I do? Thanks ...

Why won't my UISearchDisplayController fire the shouldReloadTableForSearchString method when I entered text into the search field?

I've been following Apple's TableSearch code example, but it's not working for me and I think I'm doing everything the same way they did it. The method below should be fired whenever the user types anything into the search box, but it never gets fired for me, just on the sample app. My header file has this implementation: @interface C...

Strange behaviour of NSScanner on simple whitespace removal

I'm trying to replace all multiple whitespace in some text with a single space. This should be a very simple task, however for some reason it's returning a different result than expected. I've read the docs on the NSScanner and it seems like it's not working properly! NSScanner *scanner = [[NSScanner alloc] initWithString:@"This is ...

iPhone keyboard, Done button and resignFirstResponder

This is probably a dumb question, but I can't find the answer in the docs. Did the "Done" button on the pop-up keyboard always cause the keyboard to disappear? I see a lot of code around the web like this: - (BOOL)textFieldShouldReturn:(UITextField *)theTextField { [theTextField resignFirstResponder]; return YES; } When I pres...

Delegate function not called on Three20 url request model

In one of my project, I want to use the TTURLRequestModel to populate the response data in XML format by passing the TTURLXMLResponse to the request. However, the delegate method is never called. Can someone tell me what I am missing in these two files? Do I need to initialize some other elements of the library? Three20Parser.h @inter...

Add UI elements at the end of a UITableView

I want to add various things below a UITableView (group styled). Like images and buttons. So that they arrange themselves just below the table. (The table's height is variable). How would I do this? Normally I guess you would just put them in the last cells of the table, but this doesn't seem possible with the grouped view, since it dr...

Reading Stacktrace in Objective-C?

I don't like real-time debugging much, but if it's necessary I'll do it. Is there any way to figure out what line of code a StackTrace in Objective-C refers to? What about the variable it refers to? For instance: 2010-05-13 19:39:11.673 Thingers[21003:207] *** -[NSCFString count]: unrecognized selector sent to instance 0x3b0ebb0 2010-0...

MPVolumeView in a UIAlertView?

Is it possibe to put an MPVolumeView in a UIAlertView? I have tried to put it inside of it, but it does not display. It may be the sizeToFit or initWithFrame: part? Is there a way of testing if the MPVolumeView is actually being created? Here's the code I initialize both the UIAlertView and MPVolumeView with: UIAlertView *volumeAlert ...

MPVolumeView, avoid displaying "No Volume Available"

Hey. I have a project with a MPVolumeView in it. It is set up, and it works, the only thing is that when I mute the device, the text "No Volume Available" comes up instead of the MPVolumeView. I would rather like the slider of the MPVolumeView to be disabled when the device is muted. The volumeView is initialized in the view volumeBoun...

When using delegates, need better way to do sequential processing

I have a class WebServiceCaller that uses NSURLConnection to make asynchronous calls to a web service. The class provides a delegate property and when the web service call is done, it calls a method webServiceDoneWithXXX on the delegate. There are several web service methods that can be called, two of which are say GetSummary and GetLi...

Editing an UIImage

I have an UIImage that I want to edit (say, make every second row of pixels black). Now I am aware of the functions that extract PNG or JPEG data from the image, but that's raw data and I have no idea how the png/jpeg files work. Is there a way I can extract the colour data from each pixel into an array? And then make a new UIImage using...

iPhone - user interaction with programmatically added UIImageView

So I'm trying to add UIImageViews programatically (in this case I don't have the option of doing it in IB) and I want to be able to refer to them and manipulate them in the -touchesBegan and -touchesMoved methods. I've added the images like this: UIImageView *newPiece = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString s...

FBConnec how to use variables in FBStream Dialog?

I am using a FBStreamDialog to publish to a users wall in my iphone app i am creating. How can i publish the value of a variable into dialog.attachment? eg. i want a name to appear in the description section ...

Is there nice tutorial of -how to create iphone 4.0 that support multitasking ?

Is there nice tutorial of -how to create iphone 4.0 that support multitasking ? meaning, create simple app in iphone 4.0 o.s that will continue working while in background and when return to forground i will see the right progress status. hope im clear. thanking in advance. ...

dynamic naming of UIButtons within a loop - objective-c, iphone sdk

Dear Members, Scholars. As it may seem obvious I am not armed with Objective C knowledge. Levering on other more simple computer languages I am trying to set a dynamic name for a list of buttons generated by a simple loop (as the following code suggest). Simply putting it, I would like to have several UIButtons generated dynamically (wi...