2012-11-15 3 views
1

webView를 표시하는 팝업을 작성하려고합니다. 지금까지 버튼을 눌렀을 때 팝 오버가 발생했지만 웹보기는 표시되지 않습니다. NSlog를 사용하여 viewDidLoad 메서드가 실행 중임을 알 수 있습니다. @ 인터페이스의 PopUpViewController : 다음 popover.h 파일에서iOS 웹보기가있는 PopOver

: 다음 코드는 내가 지금까지 가지고있다 UIViewController에

@property를 (강한 비 원자) 함께 IBOutlet있는 UIWebView * liveTimingPopUp;

가 popover.m 파일에서

을 @end 다음 팝 오버를 생성하는 버튼을 포함

#import "PopUpViewController.h" 

@interface PopUpViewController() 

@end 

@implementation PopUpViewController 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    [self loadWebView]; 

} 

- (void) loadWebView 
{ 
    // Do any additional setup after loading the view. 
    NSString *fullURL = @"www.google.com"; 
    NSURL *url = [NSURL URLWithString:fullURL]; 
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; 
    [_liveTimingPopUp loadRequest:requestObj]; 
    [self loadView]; 

    NSLog(@"PopUpView Fired"); 
} 

- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

@end 

제어 감안 .H 파일 :

#import <UIKit/UIKit.h> 

@interface SecondViewController : UIViewController 
{ 
    UIInterfaceOrientation intOr; 
    // APICallsViewController *pendingApiCallsController; 

} 
@property (strong, nonatomic) IBOutlet UIWebView *liveVideoPage; 
- (IBAction)liveTimingButton:(id)sender; 
@property (strong, retain) UIPopoverController *popOver; //declare UIPopOver so that you have an object to work with 

-(void) loadVideo; 
@end 

제어 감안 popover .m 파일을 생성하는 버튼이 포함되어 있습니다.

#import "SecondViewController.h" 
#import "PopUpViewController.h" 

@interface SecondViewController() 

@end 

@implementation SecondViewController 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 
    [self loadVideo]; 

} 

- (void) loadVideo 
{ 
    NSString *fullURL = @"http://192.168.130.230:1935/live/camera.stream/playlist.m3u8"; 
    NSURL *url = [NSURL URLWithString:fullURL]; 
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; 
    [_liveVideoPage loadRequest:requestObj]; 
} 


-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 
    intOr = self.interfaceOrientation; 
    if (intOr == UIInterfaceOrientationPortrait) 
    { 
     NSLog(@"portrait"); 

     _liveVideoPage.frame = CGRectMake(10, 100, 600, 550); 
    } 
    else 
    { 
     NSLog(@"landscape"); 

     _liveVideoPage.frame = CGRectMake(200, 100, 600, 550); 
    } 
} 


- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

- (IBAction)liveTimingButton:(id)sender 
{ 
    if ([_popOver isPopoverVisible]) { 
     [_popOver dismissPopoverAnimated:YES]; 
    } 

    else 
    { 
    PopUpViewController *PUVC = [[PopUpViewController alloc]init];//instantiate ViewController for popOver's content 
    _popOver = [[UIPopoverController alloc] /* create Popover*/initWithContentViewController:PUVC]; //fills popover with PopUpViewController 
    _popOver.popoverContentSize = CGSizeMake(800, 250); 
    [_popOver presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; //specifies where the popover is coming from...the liveTiming Bar button 
    } 
} 
@end 

도움을 주시면 대단히 감사하겠습니다.

답변

0

어디에서 오는 웹보기가 있습니까? VC는 xib 이름을 전달하지 않습니다. 그래서 콘센트는 결코 내기를 걸지 않을 것입니다.

+0

바로 지금, 스토리 보드에 매달려 있습니다. 이 작업을하는 방법을 잘 모르겠습니다. 나는 정말로 새로운 ios와 객관적인 C입니다. 저는 C++입니다. – Alan

관련 문제