我想使我的網站視圖頂部地址欄和底部欄按鈕,如Safari瀏覽器,我用safari代替網頁視圖,但我不能自定義大小safari,實際上我想在底部顯示tabbar,我通過在另一個視圖中添加Safari瀏覽器,然後添加到我的主視圖作爲子視圖,但總是我的標籤欄隱藏在瀏覽器後面,所以我想在我的web視圖中顯示它像這樣如何顯示帶有地址欄和底部工具欄按鈕的webView像safari
任何人都可以幫我嗎?
我想使我的網站視圖頂部地址欄和底部欄按鈕,如Safari瀏覽器,我用safari代替網頁視圖,但我不能自定義大小safari,實際上我想在底部顯示tabbar,我通過在另一個視圖中添加Safari瀏覽器,然後添加到我的主視圖作爲子視圖,但總是我的標籤欄隱藏在瀏覽器後面,所以我想在我的web視圖中顯示它像這樣如何顯示帶有地址欄和底部工具欄按鈕的webView像safari
任何人都可以幫我嗎?
試試這個代碼
[webview goFarward];
[webview goBack];
您需要構建複合視圖並編寫代碼以將所有內容(webview,按鈕,地址欄,搜索欄)粘合在一起。
編輯:添加小例子:
FullWebView.h:
#import <UIKit/UIKit.h>
@interface FullWebView : UIView
@end
FullWebView.m:
#import "FullWebView.h"
@interface FullWebView()
@property (nonatomic, retain) UIWebView* webView;
@end
@implementation FullWebView
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self) {
[self setup];
}
return self;
}
- (void) setup
{
UIButton* backButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
backButton.frame = CGRectMake(0, 0, 140, 40);
[self addSubview:backButton];
self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 40, self.bounds.size.width, self.bounds.size.height - 40)];
[self addSubview:self.webView];
//Glue code for back button
[backButton addTarget:self action:@selector(backTapped:) forControlEvents:UIControlEventTouchUpInside];
}
- (void) backTapped:(id)sender
{
[self.webView goBack];
}
@end
你好,我是使應用程序看起來像野生動物園,我想知道如何使用Safari瀏覽器webview花邊?非常感謝! – Suge