Category Archives: Iphone

Rotate UIView in Cocoa Touch

Questions: I have seen other people who have had this question, but most of the responses aren’t working on the latest 3.0 build of iPhone OS. Anyway, I’m wondering how I can programatically rotate a UIView without any input from the accelerometer. The code I have found so far: CGAffineTransform transform = CGAffineTransformMakeRotation(3.14159/2); view.transform =… Read More »

Google Map Route Draw on IPhone

Questions: I am developing an application that has two versions. One for web and another for iPhone. In the web app, I am able to draw a route on the road (drawing the route automatically that follows roads/highways) and off road (draw direct line between two specific points). Is there an API, for iPhone, that… Read More »

How to call default implementation of heightForRowAtIndexPath?

Questions: In my heightForRowAtIndexPath method I want to customize height only for certain rows. For the rest I want the framework to take care. How would I do that? Answers: You can just return tableView.rowHeight, which is set to a default value unless you change it. Questions: Answers: Return the constant UITableViewAutomaticDimension. Available since iOS… Read More »

UIView did appear?

Questions: I’m wondering, is there a way to get a delegate or something, when a particular UIView has been shown on the screen ? Answers: Try these: – didAddSubview: – willRemoveSubview: – willMoveToSuperview: – didMoveToSuperview – willMoveToWindow: – didMoveToWindow – viewDidAppear: Questions: Answers: If you are managing the UIView via a UIViewController, then you can… Read More »

Core data: any way to fetch multiple entities?

Questions: I’m just getting started with Core Data, and as a learning exercise I’m building an app where I need to display different types of objects in a single table view. As an example, say I have an entity for “Cheese” and an unrelated entity for “Pirate”. On the main screen of my app, the… Read More »

Objective-C – Overriding method in subclass

Questions: I am having some trouble figuring out hour to accurately override a method in one of my subclasses. I have subclass (ClassB) of another customclass (ClassA): @interface ClassB : ClassA { } and within ClassA, there is a method called: -(void)methodName; which fires correctly. However, I need this method to fire in ClassB. I’ve… Read More »

UIViewController ( init and initWithNibName )

Questions: Wish to know more about the practical differences between init and initWithNibName. SO answers such as this suggests that it is better to call “initWithNibName” indirectly through “init“. Are there any circumstances that we need to define “init” and “initWithNibName” differently ? Is it possible that any Nib file needs to be loaded more… Read More »