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
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];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.