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

UIModalTransitionStylePartialCurl doesn't get back to previous state. (Not dismissing)

I’ve got 2 view controllers, let’s say A and B. In A, I’m calling B to be shown with transition style UIModalTransitionStylePartialCurl [b setModalTransitionStyle:UIModalTransitionStylePartialCurl]; [self presentModalViewController:b animated:YES]; It is working fine. However when I press the curled area in the program compiled with iOS 4.3. It does not dismiss at all. It doesn’t get back […]

How to use NSURLSessionDataTask in Swift

Can someone help me? I can’t find a good example for the completion syntax. var url : NSURL = NSURL.URLWithString(“\(searchTerm)&media=software”) var request: NSURLRequest = NSURLRequest(URL:url) let config = NSURLSessionConfiguration.defaultSessionConfiguration() let session = NSURLSession.sessionWithConfiguration(config) NSURLSessionDataTask(session.dataTaskWithRequest(request, completionHandler: ((NSData!, NSURLResponse!, NSError!) -> Void)?) Thanks!

How to download file in swift?

I just started learning apple swift programming for iOS coming from android. I basically can now read and manipulate swift code and also learned some common classes used in iOS swift programming but still having some confusion with the syntax and everything. I’m trying to download file. Like, lets just say coming from this URL […]

Choosing the right IOS XML parser

There are a million different XML parsers for the iPhone. I have a medium sized XML file that contains alot of duplicate tags (at different points in the hierarchy). I was thinking about TBXML but I was concerned about its lack of XPath support. For instance lets say my XML file looked like this. <blog> […]

Behaviour for significant change location API when terminated/suspended?

This is the section from the CLLocationManager documentation describing the app behavior with startMonitoringSignificantLocationChanges: If you start this service and your application is subsequently terminated, the system automatically relaunches the application into the background if a new event arrives. In such a case, the options dictionary passed to the application:didFinishLaunchingWithOptions: method of your application delegate […]

How do I show/hide a UIBarButtonItem?

I created a toolbar in IB with several buttons. I would like to be able to hide/show one of the buttons depending on the state of the data in the main window. UIBarButtonItem doesn’t have a hidden property, and any examples I’ve found so far for hiding them involve setting nav bar buttons to nil, […]

How to differentiate between iphone4 and iphone 3

I am trying to build a game for the iphone using cocos2d engine. I wanted to know how can I tell a difference whether the user is using iphone 4 or iphone 3 as I wanted to load hi-resolution graphics for the iphone4 and low-resolution for iphone 3. I know if I use @2x.png at […]

Implicitly unwrapped optional assign in Xcode 8

In Xcode 8 release version, i found a strange scene. Here is the code, let implicitlyUnwrappedOptionalString: String! = “implicitlyUnwrappedOptionalString” let foo = implicitlyUnwrappedOptionalString print(implicitlyUnwrappedOptionalString) print(foo) and here is the result: implicitlyUnwrappedOptionalString Optional(“implicitlyUnwrappedOptionalString”) These above shows that when i assign a implicitly unwrapped optional to a variable without a explicit type, the type will be inferred […]

Detect iOS version less than 5 with JavaScript

This is related to the “fix” for position:fixed in older versions of iOS. However, if iOS5 or greater is installed, the fix breaks the page. I know how to detect iOS 5: navigator.userAgent.match(/OS 5_\d like Mac OS X/i) but that won’t work for iOS6 when it eventually comes around, or even iOS 5.0.1, only a […]

Calculating battery life in iOS

Wondering if there are references beyond the Apple tech stats for calculating battery life. I’ve tried comparing some existing battery apps (battery % left * Apple’s figures) and I dont come up with the same answers sometimes. Also there are stats for using 2G cell (as opposed to 3G) and I dont see anything on […]