iphone

Can a NSDictionary take in NSSet as key?

I know you can use any object as key for NSDictionary but the problem is will it be able to retrieve the correct value? Support I have an entry where the key = {1,3,5} and value = { @"hello" }. Will I be able to retrieve from this dictionary entry by passing in the set {3,5,1}? In order words, is the key matched based on the pointer or...

Memory leak in NSMutableDictionary, NSArray in NSXMLParser

I'm suffering from a bad memory leak parsing one of my xml documents. I'm using the NSXMLParser to iterate each node (album in the xml sample below), then iterate each photo node and add the result to an NSArray. I have 2 retained properties, which store two values on each loop. These values are added to a NSMutableDictionary object a...

Change the scale factor in UIScrollView

Hi, Is it possible to change the scaling factor of a UIScrollView? What I mean is I can only use two pinch gesture to completely zoom-out the content view to its minimum scale or two expand gesture to completely zoom-in the content view to its maximum value. Like for example, the minimum scale of the UIScrollView is 0.32 and just by two...

How to unit tests functions which return results asyncronously in XCode?

I have something like - (void)getData:(SomeParameter*)param { // Remotely call out for data returned asynchronously // returns data via a delegate method } - (void)handleDataDelegateMethod:(NSData*)data { // Handle returned data } I want to write a unit test for this, how can I do something better than NSData* returnedDat...

Padlock icon with iPhone frameworks in Xcode

I'm getting a lot of linker errors (and missing architectures in i386), and I've noticed that my frameworks have got little white padlock items next to them... what does this mean? How can i solve the missing architecture error for UIKit and Foundation? ...

Can I limit the character set for a UITextField?

I have a bitmap font which which doesn't have every single character, such as accented characters (é î ü etc) or symbols such as "¥" or © which I'm using to display usernames in a Highscore table for a game. Is it possible to limit the UIKit keyboard to certain characters, or only allow certain characters in the UITextField? Or will I ...

application crash only in iphone 3GS on airplane mode!

HI! my application works great on any device except for iphone 3GS on airplane mode. the crash comes up as soon as i open the app, which use a CLLOCATION data as soon as it starts. this fact leads me to the idea that the problem is with the CLLOCATION manager or something like that... anyone knows about a different between the location...

How to detect & avoid the use of private APIs in third party libraries

Now that Apple is running some kind of static analysis to automatically check for private API use, a number of people have been caught because of the Three20 library. I use another third-party library (which I compile myself from code) and I would like to automatically audit it for private API use before I submit to Apple, so I can elimi...

converting NSString to precise number for performSelector: afterDelay:

I am communicating with a webservice to retrieve a numerical value that comes into my function as an NSString. This number tells me the precise amount of time to wait until I perform another action, and it is critical that it be precise. As an example, if the string is "89283", then this means I must wait 89.283 seconds. So I'd like...

How to detect iPhone OS version using macros

I would like to detect iPhone OS version in my app. I have tried using detection code but was advised to use macros. Does someone experience, can you post sample code, and what library to use. ...

Why does UIImageView appear to be partially transparent

I have a simple app that just displays a UIImageView. For some reason the image appears that it is partially transparent as it is much lighter than if I view the same image in photoshop. Any suggestions...I though by default a UIView is opaque. ...

iPhone + UIView. Enormous memory consumption during drawRect. Any strategies for reducing this?

My data visualization app incurs a large memory consumption spike during redraw (setNeedsDisplay which triggers drawRect). I am currently redrawing the entire view that houses the data plot. This view is much larger then the device display. Is there any way to tell CoreGraphics to allocate just enough memory to draw each element (each e...

How I force a "container" UIView to have no CALayer?

I am trying to conserve memory consumption in my visualization about. I have a scrollView with a containerView that contains some child views. I would like to eliminate the CALayer of the scrollView and containerView. So, just the child views consume memory during redraws, etc. How do I do this? Thanks, Doug ...

iphone - stop and restore method

hi, i'm using this function to create movement, how do i stop the movement? i want it to restore to the start point. thanks. [NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(shuffleOnTimer) userInfo:nil repeats:YES]; -(void) shuffleOnTimer { jb.center = CGPointMake(jb.center.x+pos1.x,jb.center.y+pos1.y);...

Problem with writeToFile with array of NSDictionary objects

I'm trying to write an array of NSDictionary objects to a .plist file on the iPhone (OS 3.0). (They are actually NSCFDictionary objects when I call the [object class] method). My problem is that it won't write to file. If I set the array to "nil" it at least creates the empty plist file but won't do it if I have these objects in the ar...

Button background setting

This question is almost embarrassing to ask, but I can't find the answer in any documentation. I have a UIButton in a view. In IB, I set the button's background to a colour. The original rectangle in the Identity Inspector shows a half-black, half-white rectangle for the button's background. I can't find anyway to set the background ...

UIButton with UIButtonTypeCustom animation bug

So there seems to be an issue with animating size transformations for UIButtons. Specifically, if you have a button of type UIButtonTypeCustom, any frame size transformations happen instantly. Movement and other animations happen as normal. Does anyone have a good fix for this? I'm guessing that it's because the custom buttons contai...

Crash logs generated by iPhone Simulator?

Are there any crash logs generated by iPhone Simulator? the Simulator crashes a lot but not leaving any traces in Console... the crash log will be useful. ...

UITextField custom background view and shifting text

I'm trying to use a custom textfield background. The problem is that the text then appears to be too close on the left. I don't see any way to shift the text without subclassing UITextField. So I'm attempting to extend and overwrite - (void)drawTextInRect:(CGRect)rect{ NSLog(@"draw rect"); CGRect newRect = CGRectMake(rect.or...

How to repro user's experience?

I've provided a couple of users with an ad hoc copy of my app. They sync fine but the app crashes just after loading. I've tried everything I can think of to repro it and everything always goes just fine for me. I've removed all profiles from my phone and removed them from the library\mobiledevices folder. No matter what I do, the ap...