Tag Archives: Objective C

NSURLSession dataTaskWithRequest:completionHander: Pain Resolved

I think I’ve just come across the iOS equivalent of a cure for chronic pain. If you’ve ever had chronic pain, an aching back, a stiff knee joint and worried about what that means, and bugged doctor after doctor, tried therapy after therapy to no avail until the cure pops you in the head, then this post is a Brockmann-equivalent.

I’d been struggling with networking services for the better part of three years in a commercial app I’ve built for a non-profit association that I am a member of, and then, in a completely unrelated circumstance, I stumbled across the answer.

The problem:

The objective-C class method, NSURLSession dataTaskWithRequest:completionHandler: behaves like it caches frequently called URLs because… it caches the results of frequently called URLs, returning the cached results!

To turn off this default behavior, I had to set the session.configuration.URLCache to NULL, not nil. session.configuration.URLCache = NULL;

Keeping Track of Moved TableViewCells

Some tableviews require users to be able to edit the cell’s row position. Easily done by enabling the -(void) tableView:(UITableView *)tableView commitEidtingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath delegate of UITableView.

Read more ...

Customize the UINavigationController pop transition

Here’s the problem: wanted to have crossfade on all transitions to/from a particular view controller.

Read more ...

iCloud Drive added But, Got Grayed-Out Folders

I added iCloud Drive to have my app save templates to iCloud. For a while it didn’t seem to load up to iCloud.

Read more ...

Get the view.tag from a UITapGesturerRecognizer tap

Firstly you create a tap gesture recognizer and then add it to the view dot. UIView dot already has the tag assigned.

UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(gotoZone:)];
[dot addGestureRecognizer:tapped];

Later, the problem in gotoZone: method is how to identify which UIView dot did the user tap? Here’s how we did it.

Setup a comparison and then cast the tap, associate the UIView with that tap, and voila, the row is the tag of that view.

if ([sender isKindOfClass:[UITapGestureRecognizer class]]) {
UITapGestureRecognizer *tap = (UITapGestureRecognizer *)sender;
UIView *view = tap.view;
row = view.tag;
}