iPhone:使用翻转转换打开本地html页面

iPhone:使用翻转转换打开本地html页面,iphone,uiwebview,Iphone,Uiwebview,嗨 我正在使用以下代码打开WebView。它在没有任何动画的情况下打开苹果网站。我想用动画打开本地html页面(例如翻转转换),并想有一个后退按钮,这样我就可以再次转到我的主要应用程序。谁能帮我一下吗 CGRect frame = [UIScreen mainScreen].bounds; UIWebView *webView = [[UIWebView alloc] initWithFrame:frame]; [webView setBackgroundColor:[UIColor white

我正在使用以下代码打开WebView。它在没有任何动画的情况下打开苹果网站。我想用动画打开本地html页面(例如翻转转换),并想有一个后退按钮,这样我就可以再次转到我的主要应用程序。谁能帮我一下吗

CGRect frame = [UIScreen mainScreen].bounds;
UIWebView *webView = [[UIWebView alloc] initWithFrame:frame];
[webView setBackgroundColor:[UIColor whiteColor]];
NSString *urlAddress = @"www.apple.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
[self.view addSubview:webView];
[webView release];

谢谢。

在将webview作为子视图添加到self.view后添加此代码

    [UIView beginAnimations:nil context:NULL];
     [UIView setAnimationDelay:    0.0f ];       // in seconds  
     [UIView setAnimationDuration: 0.5f ];       // in seconds
     [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight 
                           forView:self.view 
                             cache:YES]; 

         [self.view addSubview:webView];

     [UIView commitAnimations ];

谢谢你,迈克。我已经添加了你所说的代码,动画持续时间为3秒,但没有任何区别!你能告诉我怎么加后退按钮吗?我必须创建NavigationBar吗?我修改了代码示例-forView:self.view,并将“addSubview”调用放在动画块中。如果你有一个UINavigationController(不是bar),你可以将你的web视图推到navController上,你会自动得到一个后退按钮。@Mike:我有点困惑。我只有主视图&没有其他选项卡。我有一个打开html页面的信息按钮。我在动画块后添加了以下代码,但它不起作用
code
UIBarButtonItem*backButton=[[UIBarButtonItem alloc]initWithTitle:@“Back”样式:UIBarButtonItemStylePlain目标:无操作:无];[self.navigationController设置NavigationBarHidden:否动画:是];self.navigationItem.backBarButtonItem=backButton;self.navigationController.navigationBar.barStyle=UIBarStyleBlack;[后按钮释放];[self.navigationController pushViewController:自设置动画:是]
code
您的网络视图是否以您希望的方式设置动画?是的。WebView动画制作完美,但未添加NavigationController。我认为它可能会被隐藏,因为我正在将WebView框架设置为屏幕大小,但事实并非如此。我已经用WebView和UIToolBar(按钮为uiBarButtonim)创建了NIB文件,并使用了以下代码。现在很好用
code
AppInfoScreen*ais=[[AppInfoScreen alloc]initWithNibName:@“AppInfoScreen”bundle:nil];[ais SetModAltTransitionStyle:UIModAltTransitionStyleFlipHorizontal];[自我呈现模式控制器:ais动画:是];[认可机构豁免]<代码>代码