iOS Development is easy with XCode, Swift3, UITableView, cocatouch, let's build iPhone, iPad and Macbook Applications.

NSDate finding nearest date to today

I have a sorted array of NSDates. Can someone help with how I can find the date in the array that is closest to the current date? I need to get the index of the date closest so that I can scroll to that date in my tableview. For example, if I have Jan 1 […]

map with photos like Instagram Photo Map

I’m trying to create a Map with photos kind of like Instagrams Photo Map. Photo Map: http://i.stack.imgur.com/B0wDa.jpg How can I get the Image (loaded from Parse), to the annotation, like in the screenshot above? And this is what I got so far: MapViewController.m [PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoPoint, NSError *error) { PFQuery *query = [PFQuery queryWithClassName: @”HomePopulation”]; […]

TypeError: Attempted to assign to readonly property. on iOS8 Safari

Hi this page on my site works fine on desktop browser, but has a weird bug on iOS8 Safari: The index template doesn’t show up, and there’s a error in the console: TypeError: Attempted to assign to readonly property. and it points to the following line: }), e(“rsvp/promise/all”, [“../utils”, “exports”], function(e, t) { “use strict”; […]

Are there any analogues of for NSAttributedString

Usually I build app interface in interface builder. Sometimes design requires to use attributed strings (fonts, colors and etc.). It’s easy to configure if string is static. But if string is dynamic (format with arguments) then there are no ways to configure attributes in interface builder. It requires to write a lot of code. I […]

Accepting invitation multipeer connectivity

I hope I am not violating NDA by posting this question. I am using the new multipeer connectivity to send using bluetooth some files to nearby devices. I have managed to send invitations, but I don’t seem to get how to display a UIAlertView where the user can accept or decline the invite. Right now […]

NSDateFormatter doesn't show time zone abbreviation for “Asia/Kolkata” for the “z” or “zzz” specifier, just the GMT offset

On iOS5 simulator and device, NSDateFormatter doesn’t show time zone abbreviation for “Asia/Kolkata” for the “z” or “zzz” specifier. NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@”Asia/Kolkata”]; NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; dateFormatter.dateFormat = @”z”; // or @”zzz” dateFormatter.timeZone = timeZone; NSLog(@”date string: %@”, [dateFormatter stringFromDate:[NSDate date]]); // “GMT+05:30”, expected “IST” NSLog(@”time zone abbreviation: %@”, [timeZone […]

Crash using Aggregate Operation: “ALL” in a Core Data iOS Application

I’m working on an iphone application and I have a simple many-to-many relationship set up with Group and Contact objects. A group can have many contacts and contacts can belong to multiple groups. I’m trying to select all groups that a particular contact does NOT already belong to using the following predicate. (Note: the uid […]

Print a UIView, but NOT by rendering as a bitmap image

Say you have a simple UIView with only text (ie, UILabel) and maybe some black lines. Here’s exactly how you can print that UIView… render it as a UIImage, and print that… – (IBAction)printB:(id)sender { // we want to print a normal view … some UILabels, maybe a black line // in this technique, depressingly […]

Show progress bar until it load the data in UIWebView IOS7

Hi in my application i have UIWebView which loads the pdf file using URL its very large file its taking too much time to load. Now i want show the user that like its loading progress until it get load the my pdf once my file loaded its has hide the progress bar, how can […]

Swift 2.1 Error sorting in place, only on release builds

I started getting crash reports for the sort lamdba in the below code, the third line in the grey box below: private func fixOverlaps(inout blocks: [TimeBlock], maxOverlaps: Int? = nil) { blocks.sortInPlace { a,b in if a.startTime < b.startTime { return true } else if a.startTime == b.startTime && a.endTime < b.endTime { return true […]