i want to use UILabel with link.
for that i am using IFTweetLabel which is finding any link and showing a line under it and it is clickable.
but if a string is big then only first line is getting hyperlink instead of complete URL.
as an issue with https://github.com/clawoo/IFTweetLabel/issues/3.
so is there any other option for it , or other library ?
First you have to import RegexKitLite framework. Go through this link. Surely this will help you. It gives same thing as you want.
http://furbo.org/stuff/FancyLabel_1.0.zip
First thing I would like to suggest is
Use UITextView with editing property as NO and it will automatically detect all the links separately similar like the one you need.
textview.editable = NO;
textview.dataDetectorTypes = UIDataDetectorTypeAll;
If you still want to go with UILabel then
You can achieve this by using NSArrtibutedStrings — but I would recommend to use some wrapper around this C-functions. I like OHAttributedLabel.
The demo included shows exactly, how hyperlinks can be handled.
You should give a try to three20 project.
what is the reason for not using UITextView..there is link detection property for UITextView.Your app is not going to get rejected
Related
I have one label which have a Dynamic string data e.g: "I am Mohit" .I want to make only "am" in bold.Is it Possible in iphone? if yes please give me suggestion.Thanks in advance:)
No you can't have text with different styles in standard UILabel. What you'll probably need to use is NSAttributedString and some custom solution to display them. Check this question for some possible options.
Not with UILabel. Suggest 2 labels, or subclass. Many related answers, including this.
No you can't have text with different styles in standard UILabel.
You need to use NSAttributedString and some custom solution to display them. Check this
done something like this using three20's TTStyledTextLabel :) it works perfectly
you can use textView instead of label to fulfill your requirement.
ex:-
[textview setContentToHTMLString:#""];
how to do the formatting in a UILabel ? for exemple , if i want to make this , Connected as Keving G , "connected as" and "kevin g" have différents colors and size . Should i use 2 UIlabel ?
There's another potential solution, but these might be too complicated for your purposes.
You can use a open source solution like OHAttributedLabel (which uses a NSAttributedString) or a CATextLayer which takes a NSAttributedString as well.
I got these answers from this related question (which includes sample code for OHAttributedLabel).
You have to use two labels and set font accordingly.
You can't do that with a UILabel.
One option is to use a UIWebView and stick HTML inside it...
TTStyledLabel can be used from three20 library
In one project XCode4 intellisence feature shows setContentToHTMLString method of UITextView but in other project intellisence feature not showing setContentToHTMLString this method of UITextView.
I want to use setContentToHTMLString method of UITextView for HTML-based Presentation-only in my textView this works in one Project but not showing even by the intellisence feature of UITextView.
Any Suggestion.
Thanks in Advance....
I don't know why Xcode has this changing behavior, but I would suggest you not to use that method, because it is in a private API, so your app would be rejected by Apple. Possibly the fact that it is private is also why sometimes it is showing (it should not), others it is not.
The way to go to display HTML content is either use a [UIWebView][2], with all its caveats, or try out Three20 styled text facilities, which are quite limited, though.
How would I go about italicizing a single word in an NSString which will be displayed in a UILabel? Specifically, I don't want all text to be italicized, just one word.
Thanks!
(Edited) I meant UILabel, not UITextField.
I don't think that what you are asking to do is possible (I'd be happy to be proven wrong). However, this library (https://github.com/facebook/three20/) is a popular way to achieve the same result in a UILabel (not text field) . The library works fairly well, but does have a lot of limitations, especially on edge conditions, and of course, it comes with associated overhead.
I'd encourage you to think about other ways of achieving the same user outcome. Can Placeholder text help? How about hints next to your text field?
Good luck.
A native UILabel does not support NSAttributedString which is what is normally used to display strings with formatting. You could try an output the text your self using Core Text but I would suggest checking out FontLabel or the three-20 project mentioned by #JJ Rohrer
Use NSAttributedString... Find controllers to draw NSAttributedString,since UILabel wont support NSAttributedString
Controller for NSAttributedString
I have a UIWebView with detect phone numbers unchecked. However, it keeps underlining the numbers in this text:
Version: 2.1 3.19.2009
The text isn't in an anchor or anything. Is there a way to force the UIWebView to not detect phone numbers?
Try
webview.dataDetectorTypes = UIDataDetectorTypeNone;
It looks like there is a problem with Interface Builder's UIWebView attributes palette; the "Detects Phone Numbers" checkbox does not seem to have any affect. Examining the UIWebView's detectsPhoneNumbers property at runtime shows that it was not actually modified by IB.
For now, setting the detectsPhoneNumbers property in code to "NO" will work fine. The problem is only with the IB palette.
Unless we're both missing something, this is a bug. I'd suggest filing it at http://bugreport.apple.com/. Additionally, you can post it at http://openradar.appspot.com/ if you'd like to make it visible to other developers.
Swift 3+ programmatically
webView.dataDetectorTypes = []
[webview setDetectsPhoneNumbers:NO];
It will work for you.....