Reputation: 1479
I want my label to read like this:
Name of Activity
nn%
Instead, here's what appears:
%@
%f%
In addition, I'm getting this warning: Expression result unused
Here's the code I'm trying:
firstLabel.text = @"%@\n%@%",[self.thisSpec activityOfInterest],focusActivityPercent;
[self.thisSpec activityOfInterest]
returns a string containing the name of an activity, and focusActivityPercent
is a double.
This is the first time I've tried a multiline label.
Any suggestions?
Thanks
Upvotes: 0
Views: 122
Reputation: 130183
You can't specify string formatting on a string literal on its own like that. In fact, the code you've shown should be producing a syntax error. You have to use NSString's stringWithFormat: class method:
firstLabel.text = [NSString stringWithFormat:@"%@\n%@%",[self.thisSpec activityOfInterest],focusActivityPercent];
Upvotes: 1