Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-17-2011, 04:19 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 2
tdmiller7873 is on a distinguished road
Cool Problem Assigning NSString to UILabel

I have defined a UILabel field as follows:

UILabel *test1;

test1 = [[[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 60.0)] autorelease];

FYI: this UILabel is being used as a subClass inside a UITableViewCell but I don't think this is relevant to the problem.

When trying to assign a value to this UILabel, I use the following code:

test1.text = record.productionDate;

//test1.text = @"2011-07-08";



The "record.productionDate" is defined in a custom NSObject (ProductionRecordObject.h) as:

@interface ProductionRecordObject : NSObject {

NSString* productionDate;
}

@property (retain, nonatomic) NSString *productionDate;


and implemented (ProductionRecordObject.m) as:

@synthesize productionDate;


I can clearly view the value in this "record.productionDate" field both in the debugger and the NSLog (it appears as an NSCFString).

But if I try to assigned it to the UILabel via "test1.text" no value shows up.

Yet if I hardcode the exact same value via "test1.text = @"2011-07-08" the value shoes up in the UILabel field just fine.


This seems so simple to me but I must have a brain leak cause I can't figure it out. Yes, I'm new to iOS programming but this seems to simple.

Thanks for any help you can provide...
tdmiller7873 is offline   Reply With Quote
Reply

Bookmarks

Tags
ios, iphone, nsstring, uilabel

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 411
15 members and 396 guests
blasterbr, buggen, Clouds, dre, EvilElf, HemiMG, jeroenkeij, jimmyon122, jonathandeknudt, LEARN2MAKE, Mah6447, n00b, nyoe, pungs, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,668
Threads: 94,121
Posts: 402,901
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jonathandeknudt
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:56 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0