Archive

Archive for the ‘iOS’ Category

Apple Crippling Parked Web Apps on the Home Screen?

March 15th, 2011 No comments

This is a little disappointing.

http://www.theregister.co.uk/2011/03/15/apple_ios_throttles_web_apps_on_home_screen/

Categories: iOS, web development Tags:

default.png loads in iOS simulator but not on a device

February 1st, 2011 No comments

The filename is case sensitive on the device. It should be

Default.png
Categories: iOS Tags:

Solved: Reachability iOS sample wasn't using the asynchronous call backs

January 27th, 2011 No comments

I tried to just use the reachabilityforInternetConnection from Apple’s example

    internetReach = [[Reachability
          reachabilityForInternetConnection] retain];
    [internetReach startNotifier];

by itself – without invoking the reachabilityWithHostName counterpart

    hostReach = [[Reachability
              reachabilityWithHostName: @"www.apple.com"] retain];
    [hostReach startNotifier];

and found that the callback was never invoked. However, when I switched and used the reachabilityWithHostName, the callbacks and subsequent notifications were being called as expected. Oh well..

Categories: iOS Tags:

Get Device Type in iOS

January 15th, 2011 No comments

The class in this post made it a snap to get the device type.

Categories: iOS Tags:

Pull To Refresh for UITableView

January 15th, 2011 No comments

I’m creating a tabbed app. On several of the tab view controllers, I have table views that are loaded with data from the cloud. I needed to have a static image at the top of the screen that doesn’t scroll away as users scroll through the table. So I solved this with an intermediate view controller.

With that, I wanted to implement a “Pull To Refresh” behavior. I tried all of these solutions:

EGOTableViewRefresh
UIPullToReloadHeaderView
several others listed here

They all seem to subclass TableViewController and when used as the view in a tab, the graphics and animations worked as expected. However, when used in my intermediate ViewControllers, the graphics didn’t appear. The calls to refresh the data were being hit – I was just having no luck getting the imagery to render in the app. So what I ended up doing, was implementing:

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView
            willDecelerate:(BOOL)decelerate
{
#ifdef LOTS_OF_LOGGING
	NSLog(@"offset = %f", scrollView.contentOffset.y);
#endif

	if ((scrollView.contentOffset.y < 0) && (refreshDelegate))
	{
		[refreshDelegate refreshData];
	}
}

The intermediate ViewController is the delegate and it throws up an UIAlertView to indicate the data is refreshing. It’s not as sexy a solution as the embedded view above the table, but it communicates to the user what the app is doing in a straightforward and easily understood manner.

Categories: iOS Tags:

New App just sent to early previewers

January 13th, 2011 No comments

I’m excited!

Categories: iOS, non-profit Tags:

UIWebView Page Title

January 13th, 2011 No comments

In some of my apps, I allow users to send an email from a web page. I send an HTML email so instead of just passing the URL as the title of the anchor, i wanted to send the page title. There is no property of the web view to do this, but I found that you can do it quickly in javascript by:

[theWeb stringByEvaluatingJavaScriptFromString:
     @"document.title"];
Categories: iOS, web development Tags:

Good article on iOS icon creation

January 5th, 2011 No comments

This is a good read.

Categories: iOS Tags:

Setting Font in UITextView

January 4th, 2011 No comments

At first I resorted to setting the font in the ViewController’s viewDidLoad.. like

	txtView.font = [UIFont
        fontWithName:@"Helvetica" size:(float)currentSize];

but then I stumbled onto this post.. And, after reading it, I was like “well of course…”

Categories: iOS Tags:

UIWebView doesn't recognize mailto links…?

December 28th, 2010 No comments

Seems like an odd thing to have to manually code but alas…

In the delegate, add.

	if ([[[request URL] scheme] isEqual:@"mailto"] &&
            [[UIApplication sharedApplication] canOpenURL:[request URL]])
	{
		if ([[UIApplication sharedApplication]
                     openURL:[request URL]])
		{
			return NO;
		}
	}

	return YES;

The canOpenURL check is more for the simulator.. Without it, the links are silently consumed. At least with this in place, I get some feedback.

A better solution would be to use the MFMailComposeViewController but opening the mail.app is good enough for my purposes in building this demo app.

Categories: iOS, web Tags: