NSFileHandle fileHandleForWritingAtPath: return null!

fileHandleForWritingAtPath is not a “creation” call. The documentation explicitly states: “Return Value: The initialized file handle, or nil if no file exists at path” (emphasis added). If you wish to create the file if it does not exist, you’d have to use something like this: NSFileHandle *output = [NSFileHandle fileHandleForWritingAtPath:self.finalPath]; if(output == nil) { [[NSFileManager … Read more

How to go back one view in UINavigationController?

I don’t mean to be rude, but this is really well documented. A google search or even an Apple documentation search on UINavigationController will turn up exactly what you need. To programmatically pop the current view controller you use: [[self navigationController] popViewControllerAnimated:YES]; To pop to a specific view controller, you use: [[self navigationController] popToViewController:controller animated:YES]; … Read more

Non-English default language for iOS App?

Defaulting to a particular language is not what you should strive for. Suppose a japanese user living in France and fluently speaking French has his phone set to Japanese. Your App would default to German, despite it having a French translation; I guess that’s not what you want and it’s certainly not what the user … Read more

How can you add a UIGestureRecognizer to a UIBarButtonItem as in the common undo/redo UIPopoverController scheme on iPad apps?

Note: this no longer works as of iOS 11 In lieu of that mess with trying to find the UIBarButtonItem’s view in the toolbar’s subview list, you can also try this, once the item is added to the toolbar: [barButtonItem valueForKey:@”view”]; This uses the Key-Value Coding framework to access the UIBarButtonItem’s private _view variable, where … Read more

What is the “Mode” property in Interface Builder which offers “Scale to fill”, “Aspect fit” etc.?

The content mode property of a view tells how its content should be laid out. In the Interface Builder, the various modes can be selected in the Attributes Inspector. Let’s use two image views to see how the various modes work. Scale to Fill The image heights and widths are stretched to match the size … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)