cocoa-touch

Switching Views from a AlertView Buttons

Application : It has 3 views Views A,B,C. There is a Alert on View B with 2 buttons on it. What I do is: I go from View A to View B. On B, I click on the Alert button to take me back on View A. Problem: When i click on the button to again go to View B then it gives an error related to "isValid" property of timer. Timer is declar...

locationServicesEnabled for iOS 3 and iOS 4

locationServicesEnabled changed from a property to a method. This is deprecated: CLLocationManager *manager = [[CLLocationManager alloc] init]; if (manager.locationServicesEnabled == NO) { // ... } Now I should use: if (![CLLocationManager locationServicesEnabled]) { // ... } I want to support iOS 3 and iOS 4 devices. How...

Getting a specific UITableViewCell out of a UITableView

Hi! I was wondering, is there any methods to retrieve a specific cell from an UITableView? For example, from where I am I can access my UITableView, so I would like to call something like cellForRowAtInteger:3 and that would return a cell so I could manipulate it. Any ideas? Thanks! ...

how to replace space by % in objective c :Iphone

Hi all. I am getting value in search box from user and storing it in NSstring *searchWord; I want that when user typed let say "Lady Gaga" then I Replace the space with % just like that searchWord=searchbar.text; now search word has "lady gaga" I want to replace it with. searchword=@"lady%gaga"; ...

UIWebview Localization

On a localized Iphone (Language set to Hebrew) when we view a webpage using safari and tap on an input field we get the keyboard up with the "Next/Previous/Done" buttons in Hebrew. When we view the same webpage using a UIWebview embedded inside our application the "Next/Previous/Done" buttons are always in English. We were thinking th...

pushViewController doing nothing in multiple tab app?

Hi all, I have a window based iPhone application with multiple tabs and a navigation bar controller which appears on all these tabs. It's a weather/climate app, so I want the user to first choose a city, then be presented with weather info in each tab for that city (they can go back to the city select from any tab using the navigation ba...

scrollToRowAtIndexPath not scrolling to correct row after 3/4 of rows

I've got an iPad app with a UITableView that has roughly 100 rows. The cells are custom, I've implemented heightForRowAtIndexPath to tell the UITableView how big my cells are. I'm using this: [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionMiddle animated:NO]; to scroll the tabl...

Get rid of cached data in didUpdateToLocation

I'm trying to get the actual position on the iPhone Simulator. But I always get the cached result. My question is related to this and this question. I'm using the code from the LocateMe example: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)ol...

Memory Leak while using UIWebView Load request in IOS4.0

Hi, I have a Web View Which loaded as a modal view. I am having memory leaks after loading a webpage using the following code. [myView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInter...

Changing the zoom out action for a UIWebView

I'm trying to change the way a UIWebView reacts when the user do a pinch out gesture (when he's doing that, I zoom out and show multiple webView). I see 2 solutions but I can't make them work : Setting scalesPageToFit to YES, and then getting events that are sent by the API to change the behavior. Problem: I don't find how to catch th...

Convert code to function

Hello everyone i need to convert this code to a function with 2 parameters in this case the first parameter is News and the second one aif can u do this ?? -(IBAction)news { CFURLRef soundFileURLRef; SystemSoundID soundFileObject; CFBundleRef mainBundle; mainBundle = CFBundleGetMainBundle (); // Get the URL to the sound file t...

Load UIView in applicationdidFinishLaunching

I want to load a UIView, first time my app loads. But I can't make it happen. Here's my applicationdidFinishLaunching method: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if(![[NSUserDefaults standardUserDefaults] boolForKey:@"AlreadyRan"] ) { [[NSUserDef...

Interface Builder: How to select nested elements?

Hi, Is there a way in interface builder to maybe see a tree of my elements so that I could select them that way. It's very hard to select things inside the actual view itself, especially when I have alot of elements and nested views, etc. Thanks ...

iOS - In-App Purchase & applicationDidBecomeActive

Hey there, I'm working on an app for 4.0 using the background methods. I'm updating the user defaults with a number that is incremented each time the app is launched. Looks like in 4.0 didFinishLaunchingWithOptions doesn't fire each time the app is launched, only the first time it's launched if it's not already in the background. So ...

Linker Error in Objective-C static library with unit testing

In my Cocoa Touch static library project, I have a target set apart for unit testing with OCUnit. When I build the project, I have several unit tests that are supposed to automatically run, but when I actually build the project, I get this linker errors: "_OBJC_CLASS_$_ObjectIntTreeMap_ObjectEntry", referenced from: objc-class-ref-to-Ob...

Sound issue exiting

I have a problem where I have sound in Menu > Level one. However when I exit Level one and go back to menu the sound won't stop! What code do I need to terminate the sound? This is the code I'm using: - (IBAction) playsound { NSString *path = [[NSBundle mainBundle] pathForResource:@"imsound" ofType:@"wav"]; AVAudioPlayer* myAudio=...

iOS: can I use one timer to trigger multiple things at certain times?

I need a button to do different things depending on how far along the person is in watching a video. So for instance at 0-20 seconds it does thing A then at 20-25 it does thing B and 25-32 thing C Can I make a timer that counts up and fires different messages off at specific intervals to enable/disable my buttons or change what they d...

How to pass userInfo in NSNotification?

Hi, I am trying to send some data using NSNotification but get stuck. Here is my code: // Posting Notification NSDictionary *orientationData; if(iFromInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { orientationData = [NSDictionary dictionaryWithObject:@"Right" forKey:@...

Should I subclass the NSMutableArray class

I have an NSMutableArray object that I want to add custom methods to. I tried subclassing NSMutableArray but then I get an error saying "method only defined for abstract class" when trying to get the number of objects with the count method. Why is the count method not inherited? I read somewhere else that I will have to import some NSMu...

Check iOS version at runtime?

This is sort of a follow on from my last question. I am using beginAnimations:context: to setup an animation block to animate some UITextLabels. However I noticed in the docs that is says: "Use of this method is discouraged in iOS 4.0 and later. You should use the block-based animation methods instead." My question is I would love to us...