博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
模态对话框
阅读量:6731 次
发布时间:2019-06-25

本文共 2793 字,大约阅读时间需要 9 分钟。

#import <UIKit/UIKit.h>

//代理的协议与模态对话框类的定义

@protocol ModalWebViewControllerDelegate; 

@interface ModalWebViewController : UIViewController{

      id <ModalWebViewControllerDelegate> delegate;

      UIWebView *webView;

}

@property (nonatomic,assign) id<ModalWebViewControllerDelegate> delegate;

@property (nonatomic,retain) IBOutlet UIWebView *webView;

-(IBAction)done;

-(IBAction)contact;

@end

 

@protocol ModalWebViewControllerDelegate

-(void)modalWebViewControllerDidFinish:(ModalWebViewController *)controller;

@end

 

//嵌入本地网页的显示出模态对话框的.m文件内容

#import "ModalWebViewController.h" 

@implementation ModalWebViewController

@synthesize delegate;

@synthesize webView;

 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.

/*

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self) {

        // Custom initialization.

    }

    return self;

}

*/

 

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.

- (void)viewDidLoad {

      NSString *path = [[NSBundle mainBundle] pathForResource:@"OurInfo" ofType:@"html"];

      NSURL *url=[NSURL fileURLWithPath:path];

      NSURLRequest *request = [NSURLRequest requestWithURL:url];

 

//webView.delegate=self;

//NSString *path = @"http://www.baidu.com";

//[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:path]]];

    [self.webView loadRequest:request]; 

    [super viewDidLoad];

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    // Overriden to allow any orientation.

    return YES;

}

- (void)didReceiveMemoryWarning {

    // Releases the view if it doesn't have a superview.

    [super didReceiveMemoryWarning];

    

    // Release any cached data, images, etc. that aren't in use.

}

- (void)viewDidUnload {

    [super viewDidUnload];

    // Release any retained subviews of the main view.

    // e.g. self.myOutlet = nil;

}

-(IBAction)done{

           [self.delegate modalWebViewControllerDidFinish:self];

}

-(IBAction)contact{

            NSLog(@"contact us!");

}

- (void)dealloc {

            [webView release];

            [super dealloc];

}

/*

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{

     NSLog(@"Web begin!");

}

- (void)webViewDidStartLoad:(UIWebView *)webView{

   NSLog(@"Web begin!");

}

- (void)webViewDidFinishLoad:(UIWebView *)webView{

    NSLog(@"Web done!");

}

*/

@end

 

-(IBAction) test{

ModalWebViewController * controller = [[[ModalWebViewController alloc]initWithNibName:@"ModalWebViewController" bundle:nil] autorelease];

controller.delegate=self;

controller.modalPresentationStyle=UIModalPresentationFormSheet;

[self presentModalViewController:controller animated:YES];

}

转载地址:http://tdfqo.baihongyu.com/

你可能感兴趣的文章
怎么写测试策略
查看>>
2018-2019-1 20165231 《信息安全系统设计基础》第四周学习总结
查看>>
jar包的一天
查看>>
python random模块
查看>>
发布使用了stage3D功能的Air for Android项目到手机上
查看>>
15. 利用ajax jquery 上传文件
查看>>
4.类与结构
查看>>
Java Foreach语句使用总结
查看>>
asp.net html中table数据转换为数组传给后台
查看>>
POJ 1584 A Round Peg in a Ground Hole
查看>>
PAT (Advanced Level) 1115. Counting Nodes in a BST (30)
查看>>
[记录]map容器的删除
查看>>
使用innobackupex基于从库搭建级联从库及一两从
查看>>
jQuery的61种选择器
查看>>
UGUI——重写Image类实现进度条
查看>>
ASP.NET:性能与缓存 转帖 张逸老师(http://www.cnblogs.com/wayfarer/articles/48347.aspx)...
查看>>
安装jdk1.8.0_11环境脚本
查看>>
php代码加密
查看>>
dataset的transformations-变形记
查看>>
python - 自动化测试框架 - sendMail
查看>>