Category Archives: Iphone

Is it possible to send a hash tag to a file url in UIWebView?

Questions: I want to load a html page from a file, and append a hash tag to it. Is this possible? I have tried NSString *filePath = [[NSBundle mainBundle] pathForResource:@”someFile” ofType:@”html”]; NSURL *fileUrl = [NSURL fileURLWithPath:[filePath stringByAppendingFormat:@”#hashtag”]]; [self.webView loadRequest:[NSURLRequest requestWithURL:fileUrl]]; NSLog(@”fileUrl = %@, reachable? %d”, fileUrl, [fileUrl checkResourceIsReachableAndReturnError:nil]); but this tries to look for the… Read More »

Open maps with specific address iOS 7

Questions: I am trying to make my application open the apple maps application and have the address be pulled up. I tried this : – (IBAction)openInMaps:(id)sender { NSString *addressString = @”http://maps.apple.com/?q=1 Infinite Loop, Cupertino, CA”; NSURL *url = [NSURL URLWithString:addressString]; [[UIApplication sharedApplication] openURL:url]; } and this : – (IBAction)openInMaps:(id)sender { NSString *addressString = @”http://maps.apple.com/?q=1_Infinite_Loop,_Cupertino,_CA”; NSURL… Read More »

prepareForSegue not called when UITableView row selected?

Questions: I have setup a UITableView using a NSFetchedResultsController that displays a number of prototype UITableViewCells. I have hooked up a push segue from my UITableViewCell to my DetailViewController. In my TableViewController I have implemented both: – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@”%s”, __PRETTY_FUNCTION__); [tableView deselectRowAtIndexPath:indexPath animated:YES]; } – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSLog(@”%s”, __PRETTY_FUNCTION__);… Read More »

Iphone sdk tabbar View outlet was not set

Questions: I’m about at the end of my rope with this freaking project!!!!!!! I have a UIViewController class that is linked to a nib that has a tabbar controller with 2 tabs. Both tabs load nib files. When I compile I get an error: -[UIViewController _loadViewFromNibNamed:bundle:] loaded the “MainViewController” nib but the view outlet was… Read More »

Custom UIButton for Iphone

Questions: I have an view in my App which has a number of buttons based on the number of items returned by the server. So if the server returns say 10 items, there should be 10 buttons and clicking on each button should call a different person. For the above purpose I created a custom… Read More »

NSPredicate dont work with double values (%f)?

Questions: My managed object has 2 double fields: “latitude”, “longitude”. I need to fetch all objects, that has certain coordinates This code not working, fetchedObjects count = 0 NSPredicate *predicate = [NSPredicate predicateWithFormat:@”latitude == %f AND longitude == %f”, coordinate.latitude, coordinate.longitude]; But this code work fine, fetchedObjects count = 3: NSPredicate *predicate = [NSPredicate predicateWithFormat:@”latitude… Read More »

Resize images in UIWebView to viewport size

Questions: I’m displaying HTML with some images inside a UIWebView in my iPhone App. When the images are wider than the viewport of the iPhone I get horizontal scrollers which I don’t want because its mostly about the text not the images. Is there a way to resize images displayed inside the UIWebView according to… Read More »

why is there a delay when moving object using UIPanGestureRecognizer

Questions: I’m moving UIView object using UIPanGestureRecognizer – how much I drag my finger on screen, that much I move the view in the same direction (only in X – left or right, Y is not changing). It works fine, but with (very noticeable) delay. Here is the method that handles the UIPanGestureRecognizer event: -(void)movePages:(UIPanGestureRecognizer… Read More »

How to add a button on the right side of the toolbar?

Questions: I created a toolbar programmatically: UIToolbar *boolbar = [UIToolbar new]; boolbar.barStyle = UIBarStyleDefault; boolbar.tintColor = [UIColor orangeColor]; [boolbar sizeToFit]; And then added a button to it: UIBarButtonItem *cancelleftBarButton =[[UIBarButtonItem alloc]initWithTitle:@”OK” style:UIBarButtonItemStyleBordered target:self action:@selector(tapBackGround:)]; cancelleftBarButton.tintColor = [UIColor orangeColor]; NSArray *array = [NSArray arrayWithObjects:cancelleftBarButton, nil]; [boolbar setItems:array animated:YES]; However, this button appears only at the left… Read More »