我不想在我的应用程序的跳板上添加快捷方式。
我遵循的方式是加载 UIWebView,然后尝试添加书签。但我不知道如何添加“+”按钮来为我的 WebView 的内容添加书签......
有没有办法这样做?还是有另一种方法可以在跳板上以编程方式添加快捷方式?
谢谢。
这在 SDK 中是不可能的。将书签图标添加到主屏幕是 Safari 应用程序的一项功能,绝对不会通过UIWebView
.
尝试这个:
//toolbar
UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 416, 320, 44)];
UIBarButtonItem *bookmarkBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self action:@selector(bookmark)];
// add btns to the bar
[toolBar setItems:[NSMutableArray arrayWithObjects:bookmarkBtn,backBtn,etc..., nil]];
// adds the toobar to the view
[self.view addSubview:toolBar];
和行动实施:
-(void)bookmarksBtn
{ [yourView yourAction]; }