Tag: cocoa touch

How can I add CGPoint objects to an NSArray the easy way?

I have about 50 CGPoint objects that describe something like a “path”, and I want to add them to an NSArray. It’s going to be a method that will just return the corresponding CGPoint for an given index. I don’t want to create 50 variables like p1 = …; p2 = …, and so on. […]

Cocoa Touch: How To Change UIView's Border Color And Thickness?

I saw in the inspector that I can change the background color, but I’d like to also change the border color and thickness, is this possible? Thanks

Is it possible to disable floating headers in UITableView with UITableViewStylePlain?

I’m using a UITableView to layout content ‘pages’. I’m using the headers of the table view to layout certain images etc. and I’d prefer it if they didn’t float but stayed static as they do when the style is set to UITableViewStyleGrouped. Other then using UITableViewStyleGrouped, is there a way to do this? I’d like […]

Responding to touchesBegan in UIPickerView instead of UIView

I have a UIPickerView that gets faded out to 20% alpha when not in use. I want the user to be able to touch the picker and have it fade back in. I can get it to work if I put a touchesBegan method on the main View, but this only works when the user […]

How to make a superview intercept button touch events?

Say I have this code: #import <UIKit/UIKit.h> @interface MyView : UIView @end @implementation MyView – (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { // How can I get this to show up even when the button is touched? NSLog(@”%@”, [touches anyObject]); } @end @interface TestViewAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; } @end @implementation TestViewAppDelegate – (void)applicationDidFinishLaunching:(UIApplication *)application […]

Can I disable UIPickerView scroll sound?

I want to disable the annoying clicks that the UIPickerView generates upon scrolling up and down. Is there a way to do this? I want to play short sounds for each item that the picker view lands upon. It gets ruined by the built in sound. I understand that the picker sounds can be turned […]

Call instance method from class method

So I need to call some instance methods from class methods in objecitve-c… Example : +(id)barWithFoo:(NSFoo *) { [self foo]; //Raises compiler warning. } -(void)foo { //cool stuff } So my question; StackOverFlow is how do you do such things in Objective-C, I’m new kinda to OOP, so am I mad, or is there a […]

Bootstrap Server Error in Xcode IPHONE

This question already has an answer here: iOS – strange error when testing on simulator 31 answers

Obtaining an NSDecimalNumber from a locale specific string?

I have some string s that is locale specific (eg, 0.01 or 0,01). I want to convert this string to a NSDecimalNumber. From the examples I’ve seen thus far on the interwebs, this is accomplished by using an NSNumberFormatter a la: NSString *s = @”0.07″; NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; [formatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; [formatter setGeneratesDecimalNumbers:YES]; […]

What's the difference between and nil?

Here’s a context where I have seen that: NSMutableArray *controllers = [[NSMutableArray alloc] init]; for (unsigned i = 0; i < kNumberOfPages; i++) { [controllers addObject:[NSNull null]]; } why not nil in that place?