Tag: cocoa touch

How to resign textfield as first responder in uitableviewcell

I use this code to resign my UITextField as firstResponder when using a standard UIView. But I now have UITextField in my UITableViewCell in a UITableView, and the code does not resign the textfield as first responder when I click outside of the textField. Any ideas how to make this work? – (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent […]

– (void)applicationWillResignActive:(UIApplication *)application never gets called

I’m trying to handle phone calls and standby and things of that nature. I added the function – (void)applicationWillResignActive:(UIApplication *)application and – (void)applicationDidBecomeActive:(UIApplication *)application to my UIApplicationDelegate. When coming out of standby, “applicationDidBecomeActive” always gets called. However the issue is “applicationWillResignActive” never gets called. I was wondering if anyone has run into this issue and […]

Check string containing URL for “http://”

I am trying to check the URL entered by the user, but I am fighting against some errors and warnings. -(BOOL) textFieldShouldReturn:(UITextField *)textField { //check “http://” NSString *check = textField.text; NSString *searchString = @”http://”; NSRange resultRange = [check rangeWithString:searchString]; BOOL result = resultRange.location != NSNotFound; if (result) { NSURL *urlAddress = [NSURL URLWithString: textField.text]; } […]

Subclasses of MKAnnotationView

I was wondering if anyone knows of any subclasses for the MKAnnotationView class. On apples documentation they say one example is the MKPinAnnotationView so I was wondering if there were other pre-created subclasses like the one used to track the devices current location. If anyone has tips for creating my own subclass of the MKAnnotationView […]

How can I determine if a user has pressed on a UITableViewCell for 2 seconds?

I am using gesture recognizers: Initialize in viewDidLoad: UILongPressGestureRecognizer *longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)]; [self.view addGestureRecognizer:longPressRecognizer]; This is what longPress looks like: – (void)longPress:(UILongPressGestureRecognizer*)gestureRecognizer { if (gestureRecognizer.minimumPressDuration == 2.0) { NSLog(@”Pressed for 2 seconds!”); } } How can I tie this into? – (void)tableView:(UITableView *)tblView didSelectRowAtIndexPath:(NSIndexPath *)indexPath How will didSelectRowAtIndexPath get a reference to […]

How to detect if delete button UItableviewcell was hidden?

I have a view that contains a UITableView. I’m able to show the delete button on the cell when the user swipes. If the user touches the delete button a method will be triggered (this works fine). But if the user decides to not to delete the cell and he touches anywhere in the view […]

Modifying an iPhone animation container view before starting animation

I am adding some basic animation to a card game I’m working on. (My first iPhone app.) I am creating a custom UIView class “AnimationContainer”, which flips from image1 to image2, while moving from rect1 to rect2. My ultimate intention is to have up to four of these containers doing their transitions simultaneously. The problem […]

static variables inside Objective-C blocks?

I’m working on some CoreAnimation stuff. A navigation controller with a few view controllers. And the view controllers have UISCrollViews for different “pages” of a “brochure.” On each page, there might be some animation that gets triggered when the user flips to that page. I was trying something like this (for one-shot animations). void (^animationBlock)() […]

Sorting an nsarray of strings not string based

So i have an array that i retrieve from a web service in no particular order example: 0 => x large, 1 => large, 2 => XX large, 3 => small, 4 => medium, 5 => x small I need to sort them: firstly based on specific – which could be reverse alphabetic: small medium […]

scrollsToTop not working

I have the following object structure: UITabBarController UINavigationController UITableViewController It used to work, but then I added the UITabBarController into the mix and made a bunch of other large changes and somewhere in between it stopped. So far I have: created a new project with that structure, and that seems to work OK. checked that […]