Tag: iphone

UITextField Autocomplete – iPhone SDK

I am trying to figure out if there is a way to implement an autocomplete functionality in a UITextField for specific values. I know that the UITextField can do this using the iPhone dictionary (much like searching google in safari, etc), but I want to be able to programmatically have it correct to certain values […]

How Do I sort an NSMutable Array with NSNumbers in it?

I’m trying to make a high score table, and suck at arrays in objective c (actually, in general objective c is challenging for me), so I can’t figure out how to sort. I’m trying to do something like this (speudocode, I’m writing this in actionscript style because I’m more comfortable with it): highscores.addObjecttoArray(score) highscores.sort(ascending) But […]

Is UIPageControl Useless By Itself?

I’ve been looking into using the UIPageControl for a scrolling part of an application, and I was wondering how it works. The docs show methods for changing pages, setting the number of pages etc., but by itself the page control doesn’t encompass any kind of scroll view. Are the UIPageControl and UIScrollView classes supposed to […]

Print out the variable name objective-C

Continued from the last question here: Log method name in Obj-C . I just wondered if there is a way to print out the variable name as well. For example: NSString *name = “vodkhang”; NCLog(@”%@”, name); and I hope that the output should be: name: vodkhang Just to summarize the previous post, currently, I can […]

How to display an image on a MKOverlayView?

UPDATE: Images who are projected on the MKMapView using a MKOverlayView use the Mercator projection, while the image that I use as input data uses a WGS84 projection. Is there a way to convert the input image, to the right projection WGS84 -> Mercator, without tiling the image up and can it done on the […]

How can I make deleteRowsAtIndexPaths: work with GenericTableViewController?

I’m using Matt Gallagher’s GenericTableViewController idea for controlling my UITableViews. My datasource is a NSFetchedResultsController. http://cocoawithlove.com/2008/12/heterogeneous-cells-in.html Everything is working fine, until I try to delete a cell. I have the following code in my View Controller: – (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the managed object. NSManagedObjectContext *context […]

How to have a UISwipeGestureRecognizer AND UIPanGestureRecognizer work on the same view

How would you setup the gesture recognizers so that you could have a UISwipeGestureRecognizer and a UIPanGestureRecognizer work at the same time? Such that if you touch and move quickly (quick swipe) it detects the gesture as a swipe but if you touch then move (short delay between touch & move) it detects it as […]

Objective C defining UIColor constants

I have a iPhone application with a few custom-defined colors for my theme. Since these colors will be fixed for my UI, I would like to define the colors in a class to be included (Constants.h and Constants.m). How do I do that? (Simply defining them does not work because UIColors are mutable, and would […]

Detect the current top cell in a UITableView after scrolling

a simple question but I don’t seem to have the right terminology to search Stackoverflow by it. I have a UITableView with no sections, the user can scroll up and down a long list of data (rows) presented inside this tableview. Question: how can I detect the most top cell row number after the user […]

MKAnnotation image offset with custom pin image

I have a MKAnnotation with an custom pin image. However the pin(MKAnnotationView) centers the image in relation to the specified coordinate. I want to set the point of the coordinate at the bottom center of the image, not center. I’ve tried using annView.centerOffset = CGPointMake(-12, -28);. But the problem is that centerOffset isn’t relevant to […]