iPhone: Setting Navigation Bar Title

The view controller must be a child of some UINavigationController for the .title property to take effect. If the UINavigationBar is simply a view, you need to push a navigation item containing the title, or modify the last navigation item: UINavigationItem* item = [[UINavigationItem alloc] initWithTitle:@”title text”]; … [bar pushNavigationItem:item animated:YES]; [item release]; or bar.topItem.title … Read more

Setting the zoom level for a MKMapView

I found myself a solution, which is very simple and does the trick. Use MKCoordinateRegionMakeWithDistance in order to set the distance in meters vertically and horizontally to get the desired zoom. And then of course when you update your location you’ll get the right coordinates, or you can specify it directly in the CLLocationCoordinate2D at … Read more

iPhone Compass GPS Direction

There is a standard “heading” or “bearing” equation that you can use – if you are at lat1,lon1, and the point you are interested in is at lat2,lon2, then the equation is: heading = atan2( sin(lon2-lon1)*cos(lat2), cos(lat1)*sin(lat2) – sin(lat1)*cos(lat2)*cos(lon2-lon1)) This gives you a bearing in radians, which you can convert to degrees by multiplying by … Read more

Making an emoji-enabeling app for the iPhone

Based on one of the samples provided in the links above you can do the following: NSString *path = [NSHomeDirectory() stringByAppendingPathComponent: @”../../Library/Preferences/com.apple.Preferences.plist”]; NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithContentsOfFile:path]; [dict setObject:[NSNumber numberWithBool:YES] forKey:@”KeyboardEmojiEverywhere”]; [dict writeToFile:path atomically:NO];

Detecting iPhone/iPod Touch Accessories

Finally found it – After initializing the Audio Session object, – AudioSessionInitialize() – you can make a call to AudioSessionGetProperty, and get the value of kAudioSessionProperty_AudioInputAvailable. AudioSessionInitialize(NULL, NULL, NULL, NULL); UInt32 propertySize, micConnected; AudioSessionGetProperty(kAudioSessionProperty_AudioInputAvailable, &propertySize, &micConnected); [self updateMicStatus:micConnected]; // user-created method According to the docs for Audio Session Services, this should be used rather than … Read more