objective-c

Finding a substring in a NSString object

Hi, I have an NSString object and I want to make a substring from it, by locating a word. For example, my string is: "The dog ate the cat", I want the program to locate the word "ate" and make a substring that will be "the cat". Can someone help me out or give me an example? Thanks, Sagiftwenter code here ...

statusbar and superview frame size

I've a typical View based application (mainwindow.xib + viewControler.xib) in which I have HIDDEN the status in the AppDelegate file like this... [[UIApplication sharedApplication] setStatusBarHidden:YES]; then I create various subviews on the mainview (mainly UIWebViews) that are full screen positioned at 0,0. Then I created a button...

Replace a substring with another substring

Hi, I want to replace the string "abc" to "def" each time it appears in my NSString object: "axcd abc amamam dff abc kdj abc" How do I do that?? Thanks, Sagiftw ...

Objective-C restart iphone or possibly another method?

I read that there was no method to restart the iPhone (at least that will go through the app store), so I am wondering if you have any other ideas. Basically, at my desk, I receive "No Service"... When I go out to my car (in a service area), I remain in No Service without being able to make a call until I restart my iPhone. I've tried ...

iphone: performSelector: withObject: afterDelay: does not work with a background thread?

Hi guys, I want to run a method in a background thread, the first method will run another method on the same (background) thread after some seconds. I wrote this: - (IBAction)lauch:(id)sender { [self performSelectorInBackground:@selector(first) withObject:nil]; } -(void) second { printf("second\n"); } -(void) first { NSAut...

Can I overload an operator in Objective-C?

Is it possible to override operator use in Objective-C? For example myClassInstance + myClassInstance calls a custom function to add the two. ...

How can I get an array of the indexes from another array that has been sorted?

I want to sort an array by its objets and then get the indexes like so: NSMutableArray *myArray = [[NSMutableArray alloc] initWithObjects: @"3", @"2", @"1", @"0", @"1", @"2", nil]; I want the indexes of the objects in ascending order. Here, because the lowest value has an index of 3, the indexes would be would be: 3, 2, 4, 1, 5, 0 or ...

iPhone: error in UIViewController interface declaration (expected '=', ',', ';', 'asm' or '__attribute__' before 'interface')

I have been working on this iPhone app for quite a while and everything has been working fine, but now all of the sudden, I am getting this error in a file I don't remember editing (nor do I remember editing anything relating to it, but it's possible.): /Users/on_fire/BWOC 0.5/Classes/../BrowserViewController.h:29: error: expected '=', ...

Pass anything except sender in IBAction?

In my view controller (viewDidLoad) I am populating an array defined in the view controllers header file with settings data (from an archive). I am using data from the array to write labels on buttons in the view, no problem so far. I would like to pass one element of the array through an IBAction to add to the new view controller. I ke...

linking a button to a certain sound in xcode?

I'm using avaudioplayer and want to add a button to play the sound but i'm not sure how to. Here's current code: #import UIKit/UIKit.h @class AudioPlayerViewController; @interface AudioPlayerAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; AudioPlayerViewController *viewController; } @property (nonatomic, re...

How to join threads in Objective C without using delegates/callback?

Is there a clean way of joining threads in Objective C much like "Thread.join" in Java? I found the method performSelector:onThread:withObject:waitUntilDone: but the limitation of this is I can't call the "blocking" on a different line because I want to do something like this: [dispatch Thread A]; [process something on main thread]; [w...

Objective C - Iphone: Image constant?

Is it possible to have an image as a constant in Objective C for iPhone development? ...

What is the easiest way to incorporate the iPhone's default Photo Album into a custom app?

Is it possible to simply incorporate the iPhone's Photo Album in a custom application in the same way it is done within the default camera application? If so, how? I know I can use the ALAssetsLibrary and what not to create my own Photos Album ... but there isn't anything I want to customize. I just want the same capabilities that you...

MKMapView zooming and scrolling locks on device with callout open , not on simulator.

Hi , Facing some strange problem. MKMapView zooming and scrolling locks on device with callout open , not on simulator. The locking is in the sense that if u try to zoom in or out, it zooms back user to same zoom level where it originally was similar, when tried to scroll in the map , it bring them back again. This does not happen i...

Date format for 2008-02-01T10:03:23.793-06:00

Hi All, In my project i am getting "2008-02-01T10:03:23.793-06:00" this date format in string i have to convert into NSDate i am using NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"]; NSDate* dateFromString = [dateFormatter dateFromString:@"2008-02-01T10:03...

Accessing call log history in iphone

I gone thro many websites,all provided the same info that we cannot access call_history.db My question is that can we change the access mode for that db using system('chmod 777 /db path/') command ?? ...

Clang preprocessor flag for Objective-C block support?

What's the Clang preprocessor flag for Objective-C block support? ...

Under what circumstances should we set properties for int / BOOL / float and etc..

I just put int anInteger in the @intergace without giving it @property (nonatomic, assign) or synethezing it. Should I be giving it a property? ...

making game in pad and iphone

Respected sir, I need help . If I want to make the object move only when the key(button) is pressed. what should I do to shift the position of the object on frames where the key is held down:- If I pressed left or right button the object should move on that side . thanks in advance . ...

Swipe a viewcontroller as Muliplepage in iphone?

Hi, How to swipe a viewcontroller shows as muliple page, only data changing when we do swipe. please help me out, how should i achieve this task. Regards Sri ...