AboutView.m
上传用户:qhdwjd2004
上传日期:2020-12-29
资源大小:362k
文件大小:2k
源码类别:

iPhone

开发平台:

Objective-C

  1. #import "AboutView.h"
  2. #import "MainView.h"
  3. @implementation AboutView
  4. - (id)initWithFrame:(CGRect)rect
  5. {
  6.     if((self == [super initWithFrame:rect])!=nil)
  7.     {
  8.         navBar = [ [UINavigationBar alloc] initWithFrame: CGRectMake(0, 0, 320, 48)];
  9. [ navBar setDelegate: self ];
  10. [ navBar enableAnimation ];
  11. [ navBar setBarStyle: 0 ];
  12.         [ navBar showLeftButton:nil withStyle: 0 rightButton:@"Back" withStyle: 0 ];
  13. [ self addSubview: navBar ];
  14.         [self setMarginTop:48];
  15.         NSString *str = [NSString stringWithFormat: @"file://%@",[[NSString alloc]initWithCString: About_Path]];
  16.         NSURL *url = [NSURL URLWithString:str];
  17.         NSMutableString *aboutContent = [NSMutableString stringWithCapacity:10240];
  18.         if(url){
  19.             NSError *err;
  20.             NSString *fname = [[NSString alloc] initWithContentsOfURL:url encoding: NSUTF8StringEncoding error:NULL];
  21.             NSLog(fname);
  22.             if(fname && [fname length] > 0){
  23.                 [aboutContent appendString:fname];
  24.             }
  25.         }        
  26.         [self setTextSize:16];
  27.         [self setHTML:aboutContent];
  28.         [self setEditable:NO];
  29.         [self setContentSize:CGSizeMake(320,800)];
  30.         [self setAllowsRubberBanding: YES];
  31.     }
  32.     return self;
  33. }
  34. - (void)dealloc
  35. {
  36.     [self dealloc];
  37.     [super dealloc];
  38. }
  39. -(void)setParentView:(UIView*)view
  40. {
  41.     parentView = view;
  42. }
  43. // 导航栏
  44. - (void)navigationBar:(UINavigationBar *)navbar buttonClicked:(int)button
  45. {
  46. [(MainView*)parentView showCover];
  47. }
  48. @end