Skip to content

Commit e392621

Browse files
committed
Update the iOS demo with SafariViewController
1 parent b4cc092 commit e392621

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Example/SDWebImageLinkPlugin/SDViewController.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#import "SDViewController.h"
1010
#import <SDWebImage/SDWebImage.h>
1111
#import <SDWebImageLinkPlugin/SDWebImageLinkPlugin.h>
12+
#import <SafariServices/SafariServices.h>
1213

1314
@interface LinkTableViewCell : UITableViewCell
1415

@@ -85,7 +86,7 @@ - (void)viewDidLoad {
8586
style:UIBarButtonItemStylePlain
8687
target:self
8788
action:@selector(switchView)];
88-
self.useLinkView = YES;
89+
self.useLinkView = NO;
8990
self.objects = [NSArray arrayWithObjects:
9091
@"https://www.apple.com/",
9192
@"https://www.apple.com/music/",
@@ -147,4 +148,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
147148
return cell;
148149
}
149150

151+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
152+
[tableView deselectRowAtIndexPath:indexPath animated:YES];
153+
NSURL *url = [NSURL URLWithString:self.objects[indexPath.row]];
154+
155+
SFSafariViewController *safariVC = [[SFSafariViewController alloc] initWithURL:url];
156+
[self presentViewController:safariVC animated:YES completion:nil];
157+
}
158+
150159
@end

0 commit comments

Comments
 (0)