if i want that i can detect the link appeared in my HTMLstring in webView...how can I do it?
I know in IB As we checkmark the box of auto detectable link... but I want to know programatically
Did you check the dataDetectorTypes property?
For example use this:
[[self content] setDataDetectorTypes: UIDataDetectorTypeAll];
You could use:
UIDataDetectorTypePhoneNumber
UIDataDetectorTypeLink
UIDataDetectorTypeAddress
UIDataDetectorTypeCalendarEvent
UIDataDetectorTypeNone
UIDataDetectorTypeAll
Reference-Link UIWebView
Related
I am new to this technology,
I am loading webpage in my webview,
I didn't set scalePageToFit property. without using this property i want to do Zooming In and Out on my webview.
is it Possible ?
Here is my Code snippet,
NSURL *url2=[NSURL URLWithString:str1];
NSURLRequest *req2=[NSURLRequest requestWithURL:url2];
[webView1 loadRequest:req2];
[webView1.scrollView setZoomScale:2.0 animated:TRUE];
[webView1 release];
str1 is my url i tried this but, still i am unable to zoom my web view in simulator.
Any help will be appreciated.
Thanks In Advance !
UIWebView is having scrollView as a property. Use ScrollView's delegate method
– scrollViewDidEndZooming:withView:atScale:
This might help you.
Follow this link : This might give you some clue. how to zoom the scrollview.
You need to set scalePageToFit property to YES.
I have a label on which I want to ensure that when user clicks the label, it opens a hyperlink attached with it in a webview.
Label and its hyperlink are fetched from an SQLite database.
Can you please let me know how to do that?
Give IBAction on your custome button
-(IBAction) goToLink
{
NSString *Links_name = #"Your link";
NSLog(#"Link : %#",Links_name);
[[UIApplication sharedApplication]openURL:[NSURL URLWithString:Links_name]];
}
You can't since you can't pass an action event with Label.
So, for this you need to use Custom Button
or either the TextView using detection property of TextView.
USing of Custom Button is much easy then using TextView.
hope that will work... :)
1) user launch application
2) user press button
3) button loads http://domain.com/mypage/?item=123
How do you trigger http://domain.com/?item=123, without opening the actual page in the browser?
NSURLConnection is the answer.
Not 100% sure of what the question is, but you could use a UIWebView. Load that UIWebView in the app with the URL and you should be good to go.
Hope this helps!
NSString* str = [NSString stringWithContentsOfURL:[NSURL URLWithString:#"http://domain.com/?item=123"] usedEncoding:NULL error:NULL]
I have used a UIWebView set to "hidden". It probably is not the most efficient way but if you normally use UIWebViews and Interface Builder then it is easy. You can also use the webview delegate methods to watch it.
On second thought - use the NSURL String method above but put it in a new thread.
I am working on an iPhone app, and would like to be able to click on a link that is in UITableView. When the Link, and only the link is selected I want the Safari app to be opened to the selected link. Any suggestions on how to do this? Thanks so much!
There are multiple solutions to your problem.
If the links are the only object in the cell, then you could just make call the didSelectRowAtIndexPath:(NSIndexPath *)indexPath function of UITableView to gather the link from your array of table data, and then use
[[UIApplication sharedApplication] openURL:myURL];
to open the URL.
Alternatively you could create your own UITableCell subclass that contains a custom button (instead of a rounded rect button) that has no image or background (only text) so that it has the appearance of a link (you could even color the text blue, and underline it...). When the user clicks the button, your handler function would then call the same openURL function as above.
The above method works best if you have multiple items in each cell (which is why you would have to create a custom cell...
A naive approach would be to embed a tiny UIWebView into each cell. UIWebView has a delegate that lets you know when a link is clicked which you can implement to launch the Safari or navigate to a new controller hosting a full screen UIWebView.
This approach might be too resource intensive and I haven't tried it myself but if it does work it would offer a lot of flexibility. Would love to know the results if you try it.
To launch a link in safari use:
NSURL *url = [NSURL URLWithString:#"http://stackoverflow.com"];
if (![[UIApplication sharedApplication] openURL:url]) {
NSLog(#"%#%#", #"Failed to open url:", [url description]);
}
Is the link in its own row in the UITableView? If so, then you can handle it within didSelectRowAtIndexPath when the appropriate row is clicked.
im working on a editable notebook type project. it consists some text and images at any time.
in UITextView if we add images as subview the frames are fixed. but i have editable option. so i must save image as NSString format in UITextView, but it should look image type in uipart. so please suggest me how can i handle this requierment.
Thanks in advance
I think you're asking for something that's not possible.
If you need to truly interleave text and graphics, UIWebView is about your only answer. But it's not editable.
I know it's too late.
As per my understanding, you can use UIWebView to insert text and images both. Create an HTML file and put it in app bundle. Set the attribute of div or paragraph(in HTML) as contentEditable = "true". And load that file:-
NSBundle *bundle = [NSBundle mainBundle];
NSURL *indexFileURL = [bundle URLForResource:#"Index" withExtension:#"html"]; // HTML file name is "Index"
[YourWebView loadRequest:[NSURLRequest requestWithURL:indexFileURL]];
This way, your UIWebView becomes editable and you can insert text and image both. Edit:- Please have a look at this link:- Adding Images to UITextView
Solved as follows. Taken Scrollview, in that managing size of the textview & inserting image with Specified size. Like textview,image,tetxview, image and goes on...
Thanks for all your support to solve the issue.