mySlate for iPad 1.03 Approved

May 20th, 2010

Screen shot 2010-05-20 at 3.56.12 PM.png

Just a heads up for anyone who has it … 1.03 of mySlate for iPad was just approved by Apple and should be propagating its way through the app store now. Here’s the changelog:

 

#WebView:

Added Bookmark Folders

Save Images with 2 finger tap on image

2 finger swipe left/right to go back/forward

#Photos:

Option to randomize the slideshow

#Videos

New display layout

#General

Change password

Contact Support from the app

 

brandon Coding, iPhone

Limiting UITableview Cell Moves Between Sections

May 1st, 2010

CBD4D958-0624-4B0E-9D08-022F7C6C8CDE.jpg

Problem: You want to limit if a tableview cell is ABLE to move to a new section, or is limited to ONLY moving to a new section. For example in mySlate I’m supporting moving bookmarks to a new section/folder. However the bookmarks are laid out in alphabetical order inside a section/folder, so re-ordering them would do no good. Each time you open the bookmarks view they are returned alphabetically from the data store.

Solution:

- (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath
{
    if( sourceIndexPath.section != proposedDestinationIndexPath.section )
    {
        return proposedDestinationIndexPath;
    }
    else
    {
        return sourceIndexPath;
    }
//Reverse those to support only moving inside a section
}

Of course supporting movement in the tableview is yours to implement.

Source: stackoverflow

brandon Coding, iPhone

Saving an Image from UIWebView

April 30th, 2010

IMG_0049.jpg

I spent the last few days trying to wrap my head around how to save a user selected image in a UIWebView. The concept itself would seem really simple, and if you’re using Safari on the iPad or iPhone it is really simple. You just tap and hold on an image. Simple. Problem is, when you’re developing you’re own application, this functionality doesn’t exist in UIWebView. Don’t believe me? Try it out for yourself. Go ahead… I’ll wait.

Ok, so if you’re still here you must have found out I’m right. The worst part of all this is I found out the hard way… from a user. I rarely save images from the web, so it never occurred to me to try it in my own app (and honestly I thought this was built in freebie functionality). Well, I got an email the other day from a user who was shocked that this didn’t work. He was not nearly as shocked as I was. I was even more shocked to find out that there’s pretty much nobody on the web who has discussed how to do this. Much time was spent searching for a solution, a couple tweets sent with only crickets responding, time was spent filling out a bug report with Apple (radar) only to have it closed without a work around as a duplicate. So, I basically hit a brick wall.

Alright, let’s get down to it. My complaining is done. Well not really. Did you also know its a huge PITA to handle touches in a UIWebView? Like to the point where you’re either having to sub-class UIWindow to trap touches or you’re having to add a view above the UIWebView. I’m going to leave it up to you as to how you want to implement what we’re talking about. I personally decided to not bother with any of it. Why? Well, I’ve already started building in a bunch of gestures, so it just made sense use a gesture recognizer instead of adding in a bunch of code which may or may not end up breaking sooner than later. My hope is that Apple fixes the problem, but I’m not holding my breath. Anyway, choose for yourself. For this example we’ll just follow the KISS method.

Ok, here come the code. First things first, you need to have some kind of way to collect touches. For simplicity we’ll use a UITapGestureRecognizer:

UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
doubleTap.numberOfTouchesRequired = 2;
[self.webView addGestureRecognizer:doubleTap];
[doubleTap release];

What we’ve done is simply define a gesture (two fingers on tap the screen at the same time) and add that to the webview. When the webview detects two fingers on the screen (tap) it’ll fire the doubleTap method which is where we’ll figure out what image has been selected (if any at all).

- (void) doubleTap:(UITapGestureRecognizer *)sender {
	int scrollPosition = [[self.webView stringByEvaluatingJavaScriptFromString:@"window.pageYOffset"] intValue];
	CGPoint startPoint = [sender locationInView:self.webView];
	NSString *js = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).tagName", startPoint.x, startPoint.y+scrollPosition];
	NSString *value = [self.webView stringByEvaluatingJavaScriptFromString:js];
	if ([value isEqualToString:@"IMG"]) {
		NSString *imgURL = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).src", startPoint.x, startPoint.y+scrollPosition];
		NSString *urlToSave = [self.webView stringByEvaluatingJavaScriptFromString:imgURL];
		}

//Do whatever you want - like a UIAlertView or UIPopover to let the user chose what to do with the image
}

So, let’s walk through the code. The first thing we need to get is where we are on the page. Without this vital chunk of information we end up sending the same coordinates to the document so even if we’re at the bottom of the web page, when we tap the top of the screen it sends the coordinates for the header image. Not good. Next we get the location of the tap in the webView itself. After that we determine which element is at the location where the user tapped. Notice we added the scroll position to the y coordinate so again we don’t end up with the same x,y all the time. ‘tagName’ returns back the element type – ‘A’, ‘IMG’, ‘IFRAME’ etc. We only want images right now (you could always grab the a ref if you wanted to do other fun stuff) so we throw an if statement in to check if the element is an image. If it is, we grab the URL of the element and do stuff with it.

When that code is all said and done you’ll end up with an NSString like so:
http://justanotheripadblog.com/wp-content/uploads/2010/04/3GiPad_thumb.jpg
Nice right?

So, that’s how I ended up saving images from a UIWebView without resorting to private API calls or other wacky business.

Sound Off: Did this work for you? Am I crazy and there was a much easier way? Please let me know in the comments. Thanks!

Credits: iCab Blog for the elementFromPoint idea – see Alexander’s comment on 9/1 11:55am, and the support folks at perfectbrowser.com who got me started looking at doing this through javascript.

brandon Coding, iPhone

gCalWall and gCalWall Updated 1.4

September 16th, 2009

Just an FYI – gCalWall and gCalWall Lite have been updated to 1.4

There was not a lot of changes to the full version – just some bug fixes however due to my update to Snow Leopard I lost all backwards compatibility with the older iPhone SDKs so the new versions do not support any iPhone platform older than 3.0. The lite version is now ad supported and almost completely the same as the full version. This is a test to see if I can actually support development on ads… if it fails then I’ll end up going back to a truly lite version.

Finally, I think I’ve got a bug where if you take a picture with the camera it is not putting that picture into the app properly. I’ll try to track that down asap and get it resolved. Not sure why it started showing up now, but I have a feeling that its only a problem on 3.1…

brandon iPhone

Quick Look: iPhone Sketchbook by Kapsoft

September 16th, 2009

IMG_0304.jpg

Here’s something I know. I know I can’t draw. I know that when I get a great little idea for an iPhone app, that there’s a couple things which are going to give me a hard time before I even get down to considering code and that’s mapping out the application itself and drawing what its going to look like when it gets on the device. Well thankfully there’s at least one new tool to ad to my arsenal and that’s the iPhone Sketchbook.

Sometimes an idea is so darned obvious that nobody really thinks about it. There’s a ton of very good iPhone books and many of them discuss planning out your application before you start writing it. There’s also many people who (like me) have done this that hard way with an iPhone like shape on a piece of paper and then maybe some horrible little icon things to represent common elements like the status bar, the signal strength and the battery. My iPhone drawings are horrible and finally there’s a book for that.

Read more…

brandon iPhone

gCalWall & Lite updates

September 7th, 2009

Just so everyone is aware – the updates were submitted over a week ago. Just got this email a little while ago:

Your application, gCalWall, is requiring unexpected additional time for review. We apologize for the delay, and will update you with further status as soon as we are able.

Thank you for your patience.

iPhone Developer Program

Waiting on Apple…

brandon iPhone

Update: gCalWall & gCalWall Lite

August 28th, 2009

Snow Leopard
Creative Commons License photo credit: BrianScott

I’ve gotten a couple of emails giving me some feedback about crashing in both applications. It would appear that some are having the app crash as soon as it opens, others are crashing when they hit the settings page and change the text options. To be honest I was able to recreate the crashes – but only on 2.x software. I had a report of the app dying on 3.0.1 but so far I haven’t seen that yet.

So, that brings me to the next points:

1. I have tried as best I can – but I can’t get any of my 3 devices to downgrade to 2.2.1 – without that I can’t test on device.

2. See the picture up there? Snow Leopard. Yea, it came out. Yea, I bought it. And while is rocks – there’s one thing that sucks… The iPhone 3.0 SDK on Snow Leopard DOES NOT support older versions of the SDK, and you can’t install older SDKs. So what does that mean? That means gCalWall and gCalWall 1.4 will be 3.0 only. With no way to test older iPhone builds there’s little I can do – SORRY!!!

3. gCalWall Lite is moving to an ad supported model. With a couple thousand users over the past few months (and over 50% of my full version users being cracked versions) – it was time to find a better way. So ad supported it is. But with ad support, I’ve decided to turn on basically everything from the full version in the lite version.

There you have it. That’s the update. Let me know what you think – and again I’m sorry for having to drop 2.x support. Unfortunately Apple has dropped 2.x support from the SDKs.

brandon iPhone

Wow! Its been a while!

July 2nd, 2009

A little update I guess is due. First thanks to everyone who bought gCalWall. I know I promised some of you an update and that is coming. I plan on starting it next week (hopefully). Apple still hasn’t fixed the API to allow me to save your wallpaper automatically, but I can work on some of the bugs and tweak things to work faster, so that’s what I’m going to do.

I’ve also decided to just leave pricing where it is. I think for what it does and the fact that I can’t set the wallpaper for you, it’s a fair price.

Again thanks to all who have purchased gCalWall. It’s definitely done well enough to cover a nice vacation with my lovely wife!

brandon General, iPhone

gCalWall Updates

April 23rd, 2009

gCalWall_128.png

I just wanted to throw up a quick post on the current state of gCalWall. I know there’s some things that are a little “wonky”. Some (minor number) of folks have seen issues with all day events, and some other stuff like blurry images. I have every intention of doing everything I can to fix these issues. I also have every intention of working in some requested improvements. But at the same time, I haven’t made much of anything off of gCalWall wall – so while its a product I intend to continue working on, it’s not a “top” priority.

So, long story short – I’m working on it, but I wouldn’t expect to release anything (aside from a major affects everybody emergency bugfix) until the iPhone 3.0 software is released. Why? Well, there’s some things I have to change for gCalWall in 3.0 to work properly and I’ve already got a development build started. So, rather than try and maintain separate builds, I’m jumping ship from 2.x and moving on to 3.x…

brandon Coding, iPhone

Support Email…

April 17th, 2009

I just had a support email come through this morning. And while as usual I responded… this one isn’t going to work out too well.

Recipient address: –CUT—@hotmail.com
Reason: Remote SMTP server has rejected address
Diagnostic code: smtp;550 Requested action not taken: mailbox unavailable
Remote system: dns;mx2.hotmail.com (TCP|17.148.16.101|63745|65.55.37.88|25)

So, if you sent in a support request to me this morning and your name is Gregg, I’m not ignoring you. Your email address that you put in the contact form just doesn’t work.

Sorry! :)

5772FD14-E545-4E2C-854A-9F5747E8D1CF.jpg

brandon General

Twitter links powered by Tweet This v1.6.1, a WordPress plugin for Twitter.