2010-05-18 4 views
1

지금까지 가장 좌절스러운 방책으로는 UIWebView를 보았습니다. 스크롤! 나는이 IBAction를 통해 전화 : Session2ViewController.m의의 viewDidLoad에서 내 UIWebView를 스크롤 할 수없는 이유는 무엇입니까?

-(IBAction)session2ButtonPressed:(id)sender 
{ 
    Session2ViewController *session2View = [[Session2ViewController alloc]initWithNibName:@"Session2ViewController" bundle:nil]; 
    self.addictionViewController = session2View; 
    [self.view insertSubview:addictionViewController.view atIndex:[self.view.subviews count]]; 
    [session2View release]; 
} 

, 내가 펜촉에서

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    // TRP - Grab data from plist 
    // TRP - Build file path to the plist 
    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Addiction" ofType:@"plist"]; 

    // TRP - Create NSDictionary with contents of the plist 
    NSDictionary *addictionDict = [NSDictionary dictionaryWithContentsOfFile:filePath]; 

    // TRP - Create an array with contents of the dictionary 
    NSArray *addictionData = [addictionDict objectForKey:@"Addiction1"]; 
    NSLog(@"addictionData (array): %@", addictionData); 

    // TRP - Create a string with the contents of the array 
    NSString *addictionText = [NSString stringWithFormat:@"<DIV style='font-family:%@;font-size:%d;'>%@</DIV>", @"Helvetica", 18, [addictionData objectAtIndex:1]]; 
    addictionInfo.backgroundColor = [UIColor clearColor]; 

    // TRP - Load the string created and stored into addictionText and display in the UIWebView 
    [addictionInfo loadHTMLString:addictionText baseURL:nil]; 
    // TODO: MAKE THIS WEBVIEW SCROLL!!!!!! 

} 

을 가지고, 나는 대리자와 콘센트에 내 웹보기를 연결. 내 주요 프로젝트를 실행하면 HTML 코드가있는 plist가 나타나지만 스크롤하지는 않습니다. 나는이 코드를 복사하여 새로운 프로젝트에 붙여 넣었다. 똑같은 방식으로 펜촉을 연결하고 badda-boom badda-bing을 연결했다. . . 그것은 작동합니다. 이 프로젝트에서 처음부터 새 펜촉을 만들려고 시도했는데 정확한 코드는 작동하지 않습니다.

위스키
탱고
폭스 트롯

어떤 아이디어가 ???

감사합니다. Thomas

답변

1

두 개의 뷰 컨트롤러를 동시에 사용하는 것과 관련된 문제라고 생각합니다. 뷰 컨트롤러가 응답 체인에 있기 때문에 문제가 발생합니다.

addictionViewController.view을 하위보기로 추가하면 두 개의 컨트롤러가 활성화되고 하나의 펜촉이 다른 펜 위에로드됩니다. 웹보기에서 스크롤하지 못하는 것보다 더 많은 문제를 보지 못한 기적입니다.

모든 시간에 활성화 된 모든보기는 단일 컨트롤러로 제어해야합니다. 이 규칙의 유일한 예외는 탐색 컨트롤러와 탭바 컨트롤러 (다른 컨트롤러와 똑같이 동작하지 않음)입니다. 다른 모든보기의 경우 화면 당 하나의 컨트롤러입니다.

두 컨트롤러를 병합하거나 한 번에 하나씩 표시하는 완전히 다른 두 개의보기를 만들어야합니다.

+0

감사합니다. 이것은 실제로 제가 배웠던 첫 번째 프로젝트 중 하나였습니다. 이제 막 돌아가서 일부 기능을 추가했습니다. 나는 그것이 몇 가지 고유 한 결점이 있음을 알고 있었고, 단지 얼마나 깊은 지 확신 할 수 없었습니다. 다시 한 번 감사드립니다! 이것은 정말로 도움이되었습니다. – Thomas

관련 문제