How do I add a rupee symbol in a UILabel
on the iPhone?
Rupee symbol is available as part of the platform itself. Go to Edit > Special Characters > Currency Symbols.
When I used it first, I was under the impression that this is part of the menu options of Xcode, but right now while I am typing here on this page opened in Firefox and I go to Edit menu, I see the same Special characters option in the menu so probably it is part of OSX itself. Just drag and drop it anywhere on the storyboard where you want this symbol to appear. I'm just dragging and dropping the same here, let's see whether it appears here or not!
₹
This integration of special characters in osx is pretty handy and also has many variations for that special character (rupee symbol in this case)
Here is How I've done this by using Unicode Character It's working and tested by me.
NSString *rupee=@"\u20B9";
NSLog(@"print rupee symbol %@",rupee);
Please refer this link UniCode Character
For Swift Language you should try!
let rupee = "\u{20B9}"
println(rupee)
// for Swift >2.0
let rupee = "\u{20B9}"
print(rupee)
more about UniChar you should check this Official Apple Doc Cheers :)
Rupee symbol is available as part of the platform itself. Go to Edit > Special Characters > Currency Symbols.
When I used it first, I was under the impression that this is part of the menu options of Xcode, but right now while I am typing here on this page opened in Firefox and I go to Edit menu, I see the same Special characters option in the menu so probably it is part of OSX itself. Just drag and drop it anywhere on the storyboard where you want this symbol to appear. I'm just dragging and dropping the same here, let's see whether it appears here or not!
₹
This integration of special characters in osx is pretty handy and also has many variations for that special character (rupee symbol in this case)
Yups, Parth is right just copy and paste the rupee symbol (₹) to NSString and you are done.
In Swift 4
let RSlabel = UILabel()
let cost = 1000
override func viewDidLoad() {
super.viewDidLoad()
RSlabel.text = "\u{20B9}"+"\(cost)"
print(RSlabel,"RSlabel")
}
May be you will have to find some language which has a similar symbol.
Or you can just copy the Rupee symbol from somewhere (like from some soft-copy document which contains that) and paste it directly from there into your UILabel text.
As for now I don't know any other way apart from this as present keyboards dont have a Rupee symbol as yet. May be in future it would be having that :)
Hope this helps you
Go to
Edit -> Emoji & Symbols
In Xcode 7, the symbols location has been changed a bit from what has been suggested by Atul.
Go through the below SO post,
Edited:
you could also go with the approach of having rupee symbol as an UIImageView
and show it before OR after a UILabel
view.
Please see the reference code :
Have below in .h
file...
UIView* iContainerView;
UIImageView* iRupeeSymbol;
UILabel* iAmountLabel;
And your .m file would be like below.
iRupeeSymbol= [[UIImageView alloc] initWithImage:myRupeeImage];
iAmountLabel.text = @"55555";
[iContainetView addSubview:iRupeeSymbol];
[iContainetView addSubview:iAmountLabel];
[self.view addSubview:iContainetView];
And set the appropriate frame value for all three views,
© 2022 - 2024 — McMap. All rights reserved.