Tag: iphone

Changing image on UIButton when user presses that button on an iPhone

I want to change the image on UIButton, when User presses that button. So, I wrote btnthumbnail2 setImage:[UIImage imageNamed:@”leaderboard_ov.png”] forState:UIControlStateNormal]; and after that I changed the view. The image is changing but not display the changed image.I think the controll goes to next view tha’s why it is happening. But I want to show the […]

NSLocale and country name

I used this code for getting which country iPhone belong to: NSLocale *locale = [NSLocale currentLocale]; NSString *countryCode = [locale objectForKey: NSLocaleCountryCode]; NSString *country = [locale displayNameForKey: NSLocaleCountryCode value: countryCode]; and I want to get the country name always in English, but if the iPhone is in any other language it returns the country name […]

Check if iOS app is in background

I want to check if the app is running in the background. In: locationManagerDidUpdateLocation { if(app is runing in background){ do this } }

How to implement UIScrollView with 1000+ subviews?

I am struggling with writing portion of an app which should behave like the native iphone photo app. Looked at iphone sdk app development book from Orielly which gave an example code for implementing this so-called page-flicking. The code there first created all subviews and then hide/unhide them. At a given time only 3 subviews […]

Can I have a UIBarButtonItem with a colored image?

I have an image that I want to display on a UIBarButtonItem, but for some reason it only shows the outline of it and the rest is all white. How can I have it actually display the image? Thanks!

presentModalViewController:Animated is deprecated in ios6

I am using the following code for an image picker. But when I run it in the simulator, I have a memory leak and I get a warning about presentModalViewcontroller:animated being deprecated in iOS6. I also get dismissModalViewController:animated deprecated. I’m using the SDK 6.1. Code for ImagePicker: – (void)showAlbum:(id)sender { imagePicker=[[UIImagePickerController alloc]init]; imagePicker.delegate = self; […]

How to get AVAudioPlayer output to the speaker

I’m recording audio with AVAudioRecorder as seen in How do I record audio on iPhone with AVAudioRecorder? I then use AVAudioPlayer to play back the recording. However the sound is coming out of the ear speaker, not the loud speaker. How would I go about redirecting the sound to the loud speaker ? TIA!

Selected UItableViewCell staying blue when selected

When I push a view after a user has selected a UITableView row, the row gets a blue highlight, and then the new view appears. That’s fine. But when I go ‘back’ the row is still highlighted in blue. Here’s my didSelectRowAtIndexPath code. – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { SettingsViewController *controller = [[SettingsViewController alloc] initWithNibName:@”SettingsView” […]

Monitor memory usage in an iphone app?

Is it possible to monitor the amount of memory your app is consuming?

Using insert rows in a UITableView

I’d like my UITableView to behave like the the table in the Contacts editor, i.e. the user should hit Edit and an “add new category” row should appear at the bottom of each section. I’m using the below code to do this, but the problem is that there is no smooth transition as there is […]