objective-c

How do I add a gradient to the text of a UILabel, but not the background?

hey, I want to be able to have a gradient fill on the text in a UILabel I know about CGGradient but i dont know how i would use it on a UILabel's text i found this on google but i cant manage to get it to work http://silverity.livejournal.com/26436.html ...

Returning object initialized through "convenience constructor"

When an instance method returns a value that was initialized with a convenience constructor, do I need to retain that object and then autorelease in the return so that when the convenience constructor's autorelease occurs, it doesn't remove the object. Will this release description before the calling code and take ownership with a retai...

Is having all views linked to one view controller a bad practice?

For my application, I have one UIViewController and about 8 UIViews. The views are all properties of the view controller, linked via the Interface Builder (IBOutlet). So when the view controller loads, all of the views are also loaded, and I have built-in methods to switch back and forth between the different views. Is it bad to have th...

Why doesn't UITableViewCell selection not draw if I tap very quickly?

I have a a UITableView with cells that are partially custom using addSubview. I am using a different cell ID for the last cell, whose purpose is to load more data from a server which will make new cells appear. (Think the "Load more messages from server" cell in Mail.app) E.g. - (UITableViewCell *)tableView:(UITableView *)tableView cel...

How am I leaking memory?

I have a table view that when loading creates a person object Person.h #import <UIKit/UIKit.h> #import "TwitterHelper.h" @interface Person : NSObject { NSDictionary *userInfo; NSURL *image; NSString *userName; NSString *displayName; NSArray *updates; } /* @property (retain) NSString *userName; @property (retain) NS...

Adding annotations to MKMapView in specific layer order

I'm displaying some icons (annotations) on a map in my app by loading them into an NSMutableArray and then adding the array. It works nicely, but I'm having trouble displaying them in proper layer order. Sometimes, icons that I've added to positionIcons last appear on top; other times, the most recent are shown below the older ones. ...

Does anyone know how to convert NSDate to Date(ticks)?

Does anyone know how to convert a NSDate to JSON Date(ticks) to have sent to a .net web service? ...

Inheritance Issues in Objective C

I created an "SDMutableGrid" class so that I could use a grid. It's just a child of NSMutableArray that contains a number for arrays equal to the number of rows in the grid. Currently, the program quits before it really starts and it appears that it is because the methods defined for NSMutableArray somehow do not apply to SDMutableGrid...

Protocols with optional properties?

The short version is that I have a protocol which has an optional parameter. When I build a class that implements it with the iPhone SDK 3.x it compiles just fine, with no errors or warnings. When I used the 2.x SDK I get the following warning: Class.m:68: warning: property 'field' requires method '-field' to be defined - use @synthesiz...

Convert UTC NSDate to local Timezone Objective-C

Does anyone know how to convert a UTC NSDate to local timezone NSDate in Objective C? ...

Call a selector that takes a char* from PyObjC

I'm trying to use a private framework with PyObjC. I've got this so far: from AppKit import * from Foundation import * import objc framework="/System/Library/PrivateFrameworks/DSObjCWrappers.framework" objc.loadBundle("DSObjCWrapper", globals(), framework) directory = DSoDirectory.alloc() directory.initWithHost_user_password_("server...

Editing an NSPredicate using NSPredicateEditor

I can create an NSPredicate easily using an NSPredicateEditor (a subclass of NSRuleEditor). What I'd like to know is this: How can I take an existing NSPredicate (one created by the editor) and reload it into the editor so that I can alter it? EDIT: I tried @John's suggestion of using setObjectValue:, but that didn't quite work. Let ...

Strange XCode/Objective-C Error: failed integrity check

Hi Everyone, I'm getting some really strange errors in XCode. Whenever I run my program, I get "malloc: test_node_integrity: FreeListNode 0x1052af0 { _prev = 0xffffffff, _next = 0xffffffff, _size = 0 } failed integrity check." I've searched all over Google, but haven't found anyone else with this error message. The stack trace has metho...

How to get background image from UITableViewStyleGrouped for any UIView?

Hi, I would like to have a UIView with the same background as a UITableView with the UITableViewStyleGrouped style (its that grey-white pattern seen in the Settings App, for example). Is this possible? Thanks in advance MrMage ...

objective-c static library class category, override method not working

I am using Three20 for the iphone and I am trying to change what a method does within it by using a class category. It compiles fine, but I never reach the break point in it. I'm assuming a class category affects all instances of the class, so I don't have to recompile the static library for it to work. I also know that the class I'm u...

className and isKindOfClass messages sent to an object

Hi, I have following piece of code NSMutableArray *mutArray = [[NSMutableArray alloc] init]; [mutArray addObject: [NSProcessInfo processInfo]]; [mutArray addObject: @"This is NSString Object"]; [mutArray addObject: [[NSMutableString alloc] initWithString: @"1st Mutable String"]]; for (id element in mutArray){ NSLog(@" "); N...

When does application state belong in Core Data instead of NSUserDefaults?

I'm trying to decide whether some application state, specifically the selected item in a list, should be stored in Core Data or NSUserDefaults. Generally I believe that application preferences and state should persist in NSUserDefaults, and model-level data should persist elsewhere, say in Core Data. My model so far is: Should the dat...

How to determine where this memory leak is coming from?

How can I determine where this memory leak is coming from in my code? It doesn't reference anything but the "main" function in my application. ...

Coding an Iphone App vs developing one on a Game Engine?

What do you guys think is better??? because I am going to start learning objective c but should I also buy this so I can make game apps easier and better?any ideas? I am definitely learning objective c but maybe I should buy this game engine so I can develop games also.????????? Some of the game engines I am think about are Unity, Torq...

UIImageView animation

Hi, I need to animate and imageview, first rotate it in one direction, shift the center and rotate it in the opposite direction in a single animation loop. What i did was :: [UIImageView beginAnimations:nil context:NULL]; [UIImageView setAnimationDuration:2.0]; [UIImageView setAnimationDelegate:self]; [UIImageView setAnimationWillStar...