Tammo
Tammo

Reputation: 47

UILabel set dynamic Text including a long long

Hi i am trying to set a UILabeltext with the remaining KB Left from a NSURLConnection Download.


NSString *left = (@"Remaining: %lli KB", (exceptedBytes-resourceLength)/1024);
[kbeleft setText:left];

But it does not work. But when i am trying to use NSLog with

NSLog(@"Remaining: %lli KB", (exceptedBytes-resourceLength)/1024);

it works without any problems

what i am doing wrong?

kind regards

Upvotes: 1

Views: 531

Answers (2)

Henrik P. Hessel
Henrik P. Hessel

Reputation: 36627

%lli isn't a valid String Format Specifier

Supported String Format Specifiers with stringWithFormat

http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265-SW1

Upvotes: 2

Evan Mulawski
Evan Mulawski

Reputation: 55334

I'm pretty sure you need to use:

stringWithFormat:

From: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/

Upvotes: 1

Related Questions