Tag: cocoa touch

Cocoa error 3840 using JSON (iOS)

I’m trying to send data to a server and receive the response in JSON format. The problem is that the server has to return “success” or “fail” but it returns “(null)”. Here’s the returned error: Error Domain=NSCocoaErrorDomain Code=3840 “The operation couldn’t be completed. (Cocoa error 3840.)” (JSON text did not start with array or object […]

How do I reset after a UIScrollView zoom?

I have a Graph being drawn inside a UIScrollView. It’s one large UIView using a custom subclass of CATiledLayer as its layer. When I zoom in and out of the UIScrollView, I want the graph to resize dynamically like it does when I return the graph from viewForZoomingInScrollView. However, the Graph redraws itself at the […]

Transforming a rectangle image into a quadrilateral using a CATransform3D

I have an image and a set of four points (describing a quadrilateral Q). I want to transform this image so that it is fits the quadrilateral Q. Photoshop calls this transformation “Distort.” But according to the source of this quadrilateral (the perspective of the image moving in space), it is in fact the combination […]

How to determine UIWebView height based on content, within a variable height UITableView?

I am trying to create a UITableView with variable height rows as explained in the answer to this question My problem is each cell contains a UIWebView with different (statically loaded) content I can’t figure out how to calculate the proper height based on the content. Is there a way to do this? I’ve tried […]

UIWebView iOS5 changing user-agent

How can I change the user-agent of UIWebView in iOS 5? What I have done so far: Using the delegate call back, intercept the NSURLRequest, create a new url request and set it’s user-agent as whatever I want, then download the data and reload the UIWebView with “loadData:MIMEType:….”. Problem: This causes infinite recursion, where I […]

Persisting Cookies In An iOS Application?

I am going to use NSHTTPCookieStorage in an iOS App to manage cookies that are retrieved from a url, and I understand that it will manage cookies during your application’s runtime. However, I was wondering if it’s possible to persist cookies after the application has closed. And then read those cookies again when the app […]

Blank space at top of UITextView in iOS 10

I have UITextView with some text in it. Everything was fine with iOS 6 but now with iOS 7 it leaves the blank space on top and then place the text below the middle of the textview. I didn’t set any contentOffSet. Please Help!

can't get correct value of keyboard height in iOS8

I was using this code to determine what is the size of the keyboard : – (void)keyboardWillChange:(NSNotification *)notification { NSDictionary* keyboardInfo = [notification userInfo]; NSValue* keyboardFrameBegin = [keyboardInfo valueForKey:UIKeyboardFrameBeginUserInfoKey]; CGRect keyboardFrameBeginRect = [keyboardFrameBegin CGRectValue]; } I’m running this in the simulator. The problem is since iOS 8 this will not give the correct value, if […]

How to compare UIColors?

I’d like to check the color set for a background on a UIImageView. I’ve tried: if(myimage.backgroundColor == [UIColor greenColor]){ …} else{ …} but that doesn’t work, even when I know the color is green, it always falls into the else part. Also, is there a way to output the current color in the debug console. […]

Super slow lag/delay on initial keyboard animation of UITextField

Alright, this problem has been driving me nuts. It takes roughly 3-4 seconds for the keyboard to pop up after I touch my UITextField. This only occurs on the first time the keyboard pops up since the app launched, afterwards the animation starts instantly. At first I thought it was problem of loading too many […]