iPhone SDK. How to assign NSString to UILabel text ?

Posted by Del on Stack Overflow See other posts from Stack Overflow or by Del
Published on 2010-05-26T18:12:42Z Indexed on 2010/05/26 18:21 UTC
Read the original article Hit count: 470

Filed under:
|

If I have a class/object like this

#import <Foundation/Foundation.h>

@interface anObject : NSObject { NSString *aProp; }

@property NSString aProp;

@end

and in the cellForRowAtIndexPath method i want to assign one of the string values from its properties to a uilabel of a tableviewcell, how do i do it?

I've tried this but it doesn't work

[[cell topLabel] setText:(NSString *)anObject.aProp];

Putting a breakpoint on the above line and inspecting it, the debugger says "variable is not a CFString

Casting the property to a CFString doesnt work Modifying the class and declaring the property as a CFStringRef doesnt work either

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsstring