cocoa-touch

Common base class/code for UIView and UIImageView - alternative to multiple inheritance in objective-c

I have some functionality that I need in all my classes which derive from either UIView or UIImageView. More specifically, I have gesture related code that both these classes need. Currently my implementation is: UIGestureView : UIView UIGestureImageView : UIImageView and make all classes derive from these. These classes will again c...

How can we get kCAOnOrderOut to work?

The Apple documentation claims that the Core Animation action key kCAOnOrderOut has one sole purpose: to animate a layer out of sight when it either becomes hidden or has -removeFromSuperlayer called on it. I'm only referring to the latter case in this question. In practice, when -removeFromSuperlayer is called, the layer is removed imm...

Realtime formatting with NSNumberFormatter in a UITextfield

I have UITextfield where a user can put in a dollar amount, I would like the textfield always to be formatted with two decimals ($ .##). The formatting has to be maintained all the time. But i'm stuck on how to append the entered numbers to existing ones in the textfield ? //This delegate is called everytime a character is inserted in ...

How to add multiple buttons to a NavigationBar?

Ok, so I've successfully added a rightBarButtonItem to call a custom selector (called from a UIViewController), as follows: UIButton* infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight]; [infoButton addTarget:self action:@selector(showInfoView:) forControlEvents:UIControlEventTouchUpInside]; self.navigationItem.rightBarBut...

Cocoa Touch & Sql Server

Is it possible to connect to Sql Server for the purpose of executing simple Sql commands within a native iPhone app? If so, how does one go about it? I'm stumped. More generally, I would at least like to see how this is done with GCC. Thanks in advance, Rich ...

Determining distance using mapkit

How is a 1000ft or 1/2 mile distance determined with mapkit? Either a radius from some pin or the distance between two pins. For example, I center the map on pin A. Pins B, C, and D are also on the map at various distances from pin A. B and C are within 1/2 mile from A but D is 1 mile away. I'd like to know that B and C are within 1...

How do I apply a sepia tone to a photo with on the iPhone?

How do I apply a sepia tone to a photo with Cocoa Touch on the iPhone? ...

Parsing nested JSON objects with JSON Framework for Objective-C

I have the following JSON object: { "response": { "status": 200 }, "messages": [ { "message": { "user": "value" "pass": "value", "url": "value" } ] } } I am using JSON-Framework (also tried JSON Touch) to parse through this and create a dictionary. I want to access the...

iPod/iPhone OpenGL ES UIView flashes when updating

I have a simple iPhone application which uses OpenGL ES (v1) to draw a line based on the touches of the user. In the XCode Simulator, the code works perfectly. However, when I install the app onto an iPod or iPhone, the OpenGL ES view "flashes" when drawing the line. If I disable the line drawing, the flash disappears. By "flash", I ...

NSMutableDictionary in iPhone

After adding the key value pairs in NSMutableDictionary, when i retrive the key/values from it, will that retrived key/value be removed from NSMutableDictionary? or is it stil maintained in NSMutableDictionary? ...

Internationalization of iPhone Applications

Are there any settings in cocoa touch so that we can select different languages in an application? i.e, in our application if we select swedish, then the swedish language must be selected and the input data must be displayed in swedish.. thank you .. ...

Drawing CGPathRef in ScrollView using Iphone sdk.

Hi all. I want to draw some curve in my scroll view using CGPathRef. I tried to draw this path but i see only the part of my CGPathRef which located at 320x480 pixels. Is it way to do that. Thank you in advance. Here is my code path = CGPathCreateMutable(); CGContextBeginPath(ctx); CGContextMoveToPoint(ctx, [[pathArray objectAtInd...

Static variable scope within class?

Can anyone tell me what the scope of the static variable in the class below is? @implementation SharedManager static id myInstance = nil; +(id)sharedInstance { if(myInstance == nil) { myInstance = [[self alloc] init]; } return myInstance; } In a test I created an instance from the class and then released it, but ...

Using pushViewController after presentModalViewController

In my app I have BaseViewController (NavigationController) as the root controller. I normally use the following code to navigate: [self.navigationController pushViewController:childController animated:YES]; But on one of the actions I want the next view to animate buttom to top, so I use: [self presentModalViewController:childContro...

Cocoa Touch. Why does NSNumber return a difference value for intValue and floatValue?

Ok, this makes absolutely no sense: I creat an NSNumber: NSNumber *n = [NSNumber numberWithInt:37669178]; I then echo the value as an integer and a float: int i = [n intValue]; float f = [n floatValue]; Here are their values: int: 37669178 float: 37669176.000000 Huh!?!?! Could someone please explain to me why this is happening and...

What does this error mean? malloc: *** error for object 0x103f000: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug

What does that mean? Getting this in the console during usage of my app in debug mode: malloc: * error for object 0x103f000: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug Does that mean I'm over-releasing something? ...

How to use NSPredicate to catch child objects?

I'm new to core data and try to get all children objects of various types with one query. Say there's an "Animal" type as parent and "Cat", "Dog" and "Bird" as children. I'd like to get both cats and dogs, but not Birds in single query returned as Animal objects. Is it possible? ...

Strange memory management issue

I can't identify the object being deallocated, I run my app with Command+Y but despite having MallocStackLogging set to YES and NSZombieEnabled set to YES, when I hit EXC_BAD_ACCESS in my app, gdb doesn't print the memory address of the deallocated object. Any ideas? Apologies if this seems vague, it looks like it's Core Data related, ...

Dynamic iPhone App icons?

The calender app does it... How can I make an app icon change based on stored info from the iPod or iPod app settings? EDIT: I realized today that it is possible to access bundles via the sdk. (At least read access) If I had a graphics API (OpenGL, perhaps) then I could possibly modify the icon like that. The operation would be: get ...

How can I set a highlighted image on a table view cell?

I've followed the code in Apple's AdvancedTableViewCells and built a table view with a background image for cells. Now I want to change it so that instead of the blue highlight colour, it shows a darker version of my image. What are the steps I need to follow to do this? I'm using a UITableViewCell subclass with a custom NIB. My backgrou...