cocoa-touch

Touch Controls working on Simulator, not on Device

See topic. It's just with one application -- 2 of them work fine, but the third (and largest, go figure) doesn't respond to touch events. I tried changing a UIImageView's location on TouchesBegan, and that doesn't show up (but it does in the Simulator!) -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch =...

Adjusting the positions of the labels in a UITableViewCell

I'm using a UITableViewCell with UITableViewCellStyleSubtitle. However, because of the background image I'm using for the cell, I don't like where the detailTextLabel is going. I want to move it and resize it within the cell, but nothing I try seems to work. CGRect currRect = cell.detailTextLabel.frame; cell.detailTextLabel.frame = CGRe...

Where's the difference between UIControlEventTouchDragOutside and UIControlEventTouchDragExit?

Both appear to have the exact same effect. They come both when the finger is far enough away from the control. The "bounds" is not really the criteria for UIControlEventTouchDragExit. It gets fired only if it's far away enough... ...

Time between touch began and touch ended

Is there any function in cocos2d or objective c to find the time between touch began and touch ended?? ...

How to provide additional custom implementation of accessor methods when using @synthesize?

I want to fire some code when a property is accessed and changed. I use @property... and @synthesze... in my code for my ivars. The properties are retained, so I'd like to keep that memory management stuff automatically generated by @synthesize. However, I assume that @synthesize tells the compiler to generate the accessor methods code ...

Is iPhone OS 64 bit or 32 bit?

Anyone knows if iPhone OS is based on 32-bit or 64-bit architecture? ...

How much does it matter if I create a NSMutableArray with capacity=3 instead of capacity=50?

I wonder if this affects performance or memory consumption a lot. I need an NSMutableArray, and at the beginning I can only guess how many objects will be added. About 3 to 5 maybe. So I create it like this: NSMutableArray *arr = [[NSMutableArray alloc] initWithCapacity:3]; What happens here exactly, when creating it with a capacity o...

Access UIButton from parent class while using function from another object class on the iPhone

I'm using openAL to play audio files. I'm using a uibutton to play an audio file. I access this play method that loads and plays the audio file from an object called oalPlayback. I have connected this button and method in interface builder by dragging the object into the nib /xib window. I then shift drag the button to the object to a...

Unable to add framework (MessageUI) to target

Obvious question if you know what/where to look...unfortunately I don't...yet. When I double-click my target and try to add the MessageUI framework it's not listed. I tried to do it manually and ran into trouble. I see that this app's target is for 2.2.1 and obviously MessageUI requires 3.0. Where can I set this? Do I need to create a n...

Creating table sections with NSFetchedResultsController

I'm using NSFetchedResultsController to drive the data for my UITableViewController. A simplified version of the managed object I am fetching looks like this (well for example): Person: -(BOOL)hasPet; -(BOOL)hasDog; Basically, I want my table to only show those Person objects who have a pet. So that's simple, I can use a predicate. No...

iPhone dev - How far down should I cast?

If I have a method that passes an argument of type void * (UIView animation did stop method, has to be a void pointer), or of type id, and I know that the argument is a UIBarButton item, and I need to disable it, [barbuttonitem setEnabled:NO];, should I cast the argument to a UIControl, which is as far as I need to be able to use setEnab...

iPhone dev - delegates, notifications, unsubscribe before deallocated?

In my question about using a delegate or a UIControl Event, this was in Kendall Helmstetter Geln's answer: Both are about an equal load to work with - with a delegate you have to set yourself and then remember to unset yourself before you are deallocated. You have to do the same thing with notifications, remember to start listening a...

Would NSMutableArray -removeObject: also remove a NSString if it has a different memory adress?

Example: I add some NSString objects to an NSMutableArray: @"Foo", @"Bar", @“FooBar". Now somewhere else I access that array again, and I want to delete @"Foo". So I create a new NSString @"Foo", and pass it to -removeObject:. The documentation does not state on what criteria -removeObject works. I think that it looks only for the memory...

Convert to grayscale - too slow

Hi, I've made a class that converts an image into grayscale. But it works way too slow. Is there a way to make it work faster? Here's my class: @implementation PixelProcessing SYNTHESIZE_SINGLETON_FOR_CLASS(PixelProcessing); #define bytesPerPixel 4 #define bitsPerComponent 8 -(UIImage*)scaleAndRotateImage: (UIImage*)img withMaxRes...

How to make the "hot area" of a UIControl bigger?

Or: How to expand the sensitive area for a UIControl without just making the view bigger? I have a pretty small button image (a little arrow), which is just 10 x 10 pixels. Too small for touching. I want the "hot area" to be 50 x 50 around that. For learning, I want to know how to do it manually, even if I could use some of the provided...

How can a covered UIControl or UIView still know about if a touch ended over it or not?

I have a UIControl (or UIView, could have either of them, doesnt matter), and this is covered by another UIControl. The other UIControl reacts nicely on touches. But the underlying UIControl also needs to know about the touch and if the touch was actually "on it" or not (from the user's perspective). The covering UIControl is partially t...

call action method for a uibutton without using interface builder in cocoa

I'm currently calling an action method in an object by dragging a button to the view in interface builder. I then drag an object to the panel and specify my object with the action method. I shift drag my button to the object and choose my action method. This works in calling my method. I would like to instead call my action method wi...

Getting an XML file from URL to NSData object ?

Hello, I need to load a .xml file from a URL adress into an NSData object for further parsing with some libraries that I already own, ( but they ask me the .xml file as NSData ), how could I do this ? The url format would be something like this: http://127.0.0.1/config.xml ...

Setting Toolbar Items of UINavigationController

In iPhone OS 3.0, you can set the toolbar items of a UINavigationController using the setToolbarItems:animated: method. However, this requires you pass in an array of UIToolbarItems. While I could programmatically create these toolbar items, I'd rather create them in Interface Builder if possible. With this in mind, I have created a UIT...

How to cancel an animation for a specific context and animationID?

I have an animation which I kick off like this: [UIView beginAnimations:@"doThis" context:self]; [UIView setAnimationDuration:1.5f]; [UIView setAnimationDelay:2.5f]; Now, the problem is that this animation is told to start in 2.5 seconds. But in the meantime, something may happen and I don't want the animation anymore. However, CA wil...