IOS - 关于我们页面

来源:互联网 发布:矩阵乘法结合律 编辑:程序博客网 时间:2024/05/21 00:52

关于我们(静态显示信息)


代码

////  CYAboutUsViewController.h//  SymptomChecker////  Created by wcl on 15/7/2.////#import "CYWebFromLocalViewController.h"@interface CYAboutUsViewController : CYModelViewController@property (nonatomic, strong) UIWebView* webView;@end
////  CYAboutUsViewController.m//  SymptomChecker////  Created by wcl on 15/7/2.////#import "CYAboutUsViewController.h"#define kViewRadio viewWidth()/320@interface CYAboutUsViewController () <UIWebViewDelegate>@end@implementation CYAboutUsViewController {    NSString* _localName;}- (id) initWithQuery:(NSDictionary *)query{    self = [super initWithQuery:query];    if (self){        self.title = query[@"title"];        _localName = query[@"local_name"];    }    return self;}- (void)viewDidLoad {    [super viewDidLoad];}- (void) viewWillAppear:(BOOL)animated {    [super viewWillAppear: animated];    [self.view setBackgroundColor:[UIColor whiteColor]];    CGRect logoRect = CGRectMake(12*kViewRadio,                                 20*kViewRadio,                                 viewWidth()-24*kViewRadio,                                 100*kViewRadio);    // Logo    UIImageView *logoView = [[UIImageView alloc] initWithFrame:logoRect];    logoView.image = [UIImage imageNamed:@"mat_logo_login.png"];    logoView.contentMode = UIViewContentModeScaleAspectFit;    [self.view addSubview:logoView];    CGRect versionRect = CGRectMake(12*kViewRadio,                                    logoView.bottom+8*kViewRadio,                                    viewWidth()-24*kViewRadio,                                    16*kViewRadio);    // 版本    UILabel *versionView = [[UILabel alloc] initWithFrame:versionRect];    versionView.text = @"V1.0.0";    versionView.textAlignment = UITextAlignmentCenter;    versionView.font = [UIFont systemFontOfSize:12*kViewRadio];    [self.view addSubview:versionView];    CGRect lineRect = CGRectMake(0,                                 versionView.bottom+16*kViewRadio,                                 viewWidth(),                                 0.5*kViewRadio);    // 直线    UIView *horizontalLine = [[UIView alloc]initWithFrame:lineRect];    horizontalLine.backgroundColor = [UIColor blackColor];    [self.view addSubview:horizontalLine];    CGRect textRect = CGRectMake(0,                                 horizontalLine.bottom+20*kViewRadio,                                 viewWidth(),                                 240*kViewRadio);    // 本地文本    _webView = [[UIWebView alloc] initWithFrame:textRect];    [_webView setBackgroundColor:[UIColor clearColor]];    _webView.delegate = self;    [self.view addSubview: _webView];    NSString *filePath = [[NSBundle mainBundle]pathForResource:_localName ofType:@"html"];    NSString *htmlString = [NSString stringWithContentsOfFile:filePath                                                     encoding:NSUTF8StringEncoding                                                        error:nil];    [_webView loadHTMLString:htmlString baseURL:nil];    CGRect endRect = CGRectMake(0,                                self.view.bottom-220*kViewRadio,                                viewWidth(),                                220*kViewRadio);    // 结尾    UILabel *end = [[UILabel alloc] initWithFrame:endRect];    [end setText:@"TEL: 400-110-0866\n(按当地市话标准收费)\nxxx有限公司\nxxx.xxx.com"];    [end setTextAlignment:NSTextAlignmentCenter];    [end setFont:[UIFont systemFontOfSize:12*kViewRadio]];    [end setNumberOfLines:4];    [self.view addSubview:end];}- (void)didReceiveMemoryWarning {    [super didReceiveMemoryWarning];}@end

效果
效果


娱乐

1 0