Reederのように、モーダルUIViewが表示されるときにUINavigationBarを画面に表示します。UInavigationBarをアニメーション化するとオフスクリーンが黒い四角形に残ります
私はアニメーションコードはすべてが働くようhttp://www.theappcodeblog.com/2011/06/02/iphone-app-animation-tutorial-animate-a-uiview-frame/
からであるshouldStartLoadWithRequest
からWebブラウザを作成し処理するために優れたSVWebViewController(https://github.com/samvermette/SVWebViewController)を使用していますナビゲーションバーの中にあるスペースは画面から外れていますが、後ろに残っているスペースは(私がアニメーション化したい)BLACKです。残りのビュー/ webviewはWHITEです。
どのようにスペースをナビバーに割り当てることができますか?つまり、ビューの背景は白ですか? xibはありません。
私は(唯一のツールバーを追加する)SVWebViewControllerにナビゲーションバーの一切の言及を見つけることができません
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
NSLog(@"They clicked: %@", request);
NSURL *requestURL = [request URL];
if ([[requestURL scheme ] isEqualToString: @"http"] || [[requestURL scheme] isEqualToString: @"https"]) {
NSLog(@"Web link %@",requestURL);
SVModalWebViewController *webViewController = [[SVModalWebViewController alloc] initWithURL:requestURL];
webViewController.modalPresentationStyle = UIModalPresentationFullScreen;
webViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
webViewController.availableActions = SVWebViewControllerAvailableActionsOpenInSafari | SVWebViewControllerAvailableActionsCopyLink | SVWebViewControllerAvailableActionsMailLink;
// ios5
if ([[UINavigationBar class]respondsToSelector:@selector(appearance)]) {
// Create image for navigation background - portrait
UIImage *NavigationPortraitBackground = [[UIImage imageNamed:@"navbar_bg_portrait~iPad"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
// Create image for navigation background - landscape
UIImage *NavigationLandscapeBackground = [[UIImage imageNamed:@"navbar_bg_portrait~iPad"]
resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
// Set the background image all UINavigationBars
[[UINavigationBar appearance] setBackgroundImage:NavigationPortraitBackground forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundImage:NavigationLandscapeBackground forBarMetrics:UIBarMetricsLandscapePhone];
[[UINavigationBar appearance] setBackgroundColor:[UIColor whiteColor]];
// The tintcolor affects the button colour
UIColor* col = OPAQUE_HEXCOLOR(0xdb536a);
[[UIBarButtonItem appearance] setTintColor:col];
} else {
// Style the Nav Bar ios4
[webViewController.navigationBar applyCustomTintColor];
}
[self presentModalViewController:webViewController animated:YES];
// -> This code hides the UINavigationBar before animation
CGRect navBarFrame = webViewController.navigationBar.frame;
navBarFrame.origin.y = -navBarFrame.size.height;
// set the position of the bar
webViewController.navigationBar.frame = navBarFrame;
// <- end Hide code
return NO;
}
return YES;
}
TIA
uiwebviewマスクを設定すると、もし私がxibを使っているのであれば、どうすればいいのですか? – JulianB
xibsを使っていません... –
私はxibを使っていません...ここにinitコードがあります - (void)loadView { mainWebView = [ [UIWebView alloc] initWithFrame:[UIScreen mainScreen] .applicationFrame]; [mainWebView setBackgroundColor:[UIColor greenColor]]; mainWebView.delegate = self; mainWebView.scalesPageToFit = YES; [mainWebView loadRequest:[NSURLRequest requestWithURL:self.URL]]; self.view = mainWebView; } – JulianB