Tag: iphone

iPhone Brainstorm – CLLocation in Background – Polling every 15 minutes

Here is the scenario. I need to have an application which polls a web service with the users location every 15 minutes whether in background / foreground. At the moment I: Start / Restart the location manager with accuracy highest and distance filter none. Wait to get within desired accurancy. Store reading setDesiredAccuracy to be: […]

Set titleview for all navigationcontroller and navigationitem

[[[UINavigationBar appearance] setTitleView:button] I tried to set title view as button for all navigation item using above line of code but it is not working.How can I set title view for all navigation bars in my project by writing small code in appdelegate ?

UIWebView: open some links in Safari, some within the view

My app features content that (for text formatting reasons) is presented in an UIWebView. Within the content there are links, some of which should open their target in mobile Safari, while others should navigate within the content. So far, I’ve catched the link requests using a UIWebView delegate. In my implementation of -(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest […]

Can I block network access for a specific moment?

Writing an iOS app, I neet to give the user the option to block the network access for this app only. Is it possible doing that in code? Meaning every call, made by whatever part of the code (and that’s including static libraries) should be blocked for that particular moment.

UIPopoverPresentationController is showing full screen modal on iPhone

On iPad UIPopoverPresentationController working fine but on iPhone it is always showing full window modal popup. i am using following code: UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@”Main” bundle:nil]; MySecondViewController *contentVC = [storyboard instantiateViewControllerWithIdentifier:@”Pop”]; contentVC.modalPresentationStyle = UINavigationControllerOperationPop; // 13 UIPopoverPresentationController *popPC = contentVC.popoverPresentationController; // 14 contentVC.popoverPresentationController.sourceRect =CGRectMake(100, 130, 280, 230); self.navigationController.preferredContentSize = CGSizeMake(200, self.parentViewController.childViewControllers.lastObject.preferredContentSize.height-100); //self.showPop.frame; // 15 […]

Always getting the same height using sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode:

The CGSize returned by sizeWithFont:minFontSize:actualFontSize:forWidth:lineBreakMode: contains always the same height. Why is that, and is there a way around this? I want to align a string vertically and it may not be truncated, unless it can’t fit on a single line using the minimum font size. So I try to use this method to get […]

Producing an NSDate with NSDateFormatter Yielding nil NSDate Value

I am trying to produce a date from a string with the following: NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@”MMMM dd, yyyy HH:mm:ss”]; NSLog(@”ENDINGDATE: %@”, [closure objectForKey:@”ENDINGDATE”]); NSDate *tempDate = [dateFormatter dateFromString:[closure objectForKey:@”ENDINGDATE”]]; The ENDINGDATE NSLog produces the following: ENDINGDATE: April, 21 2011 20:00:00 Everything seems to be fine, so I am stumped as […]

Dynamic generation of data members

I have made one application which can parse the given xml file independent of its tags . It is working well and good for at list single level of xml file .I want to assign the xml values on the object.As xml can be different the class also must be generic one and the data […]

How to validate the empty string in Objective C?

I want to validate the string value after getting in the below parser delegate method I have tried like [string length]>0 ,(string !=NULL) in if condition still blank string is printed in the NSlog.So what is the efficient method to validate the sting.I have used the below code. – (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if […]

changing the MFMailComposeViewController navigationBar title font

I have a MFMailComposeViewController and when I’ve set the subject it also sets it as the subject. The question is how do I customize the font of the title and color? MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; [picker setSubject:@”Feedback for MyApp”];