2

このエラー「CGAffineTransformInvert」の理由

私は心配する必要がありますか?

ビューのある .xib と、ビューの外側にあるが同じ xib 内にある 4 つの webView があります。次に、コードで、webViews をサブビューとしてビュー内のスクロール ビューに追加します。それは問題を引き起こしますか?

コードは以下のとおりです。

//Called first to initialize  this class. Also, initializes the nib file and tab bar name.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = NSLocalizedString(@"More", @"More");
        self.tabBarItem.image = [UIImage imageNamed:@"first"];
    }
    return self;
}

//Initialize the more tab titles and views
-(void)initViewsandTitles{
    MoreTabPages = [NSArray arrayWithObjects:self.aboutWebView,
                    self.newsUpdateWebView,
                    self.feedbackWebView,
                    self.creditsResourceWebView, nil];
    titles = [[NSArray alloc] initWithObjects:@"About Locavore",
              @"News and Updates",
              @"Feedback",
              @"Credits and Resources", nil];
}

//Initialize the URLs
-(void)initURLs{
    websites = [[NSArray alloc] initWithObjects:@"http://www.getlocavore.com/",
                @"http://twitter.com/enjoy_locavore",
                @"https://getsatisfaction.com/localdirt/products/localdirt_locavore",
                @"http://www.getlocavore.com/about", nil];
}

//Called after the controller's view is loaded into memory.
- (void)viewDidLoad
{
    [super viewDidLoad];                    //Call the super class init method
    [self setupSpinner];                    //Start the spinner animatio
    [self initViewsandTitles];              //Initialize the views and titles
    [self initURLs];                        //Initialize the URLs
    [self setScrollandPageViewProperties];  //Set the scroll and page view properties
    [self setUpPageViews];                  //Create the web pages
}

//UIScrollViewDelegate Protocol Reference. Called whn the user scrolls the content within the reciever
- (void)scrollViewDidScroll:(UIScrollView *)sender {

        if (!pageControlBeingUsed) {

                // Switch the indicator when more than 50% of the previous/next page is visible
                CGFloat pageWidth = self.MoreTabScrollView.frame.size.width;
                int page = floor((self.MoreTabScrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1;
                self.MoreTabPageControl.currentPage = page;
        self.MoreTabTitle.text = [titles objectAtIndex:page];
        }
}

//UIScrollViewDelegate Protocol Reference. Called when the scroll view is about to start scolling content
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
        pageControlBeingUsed = NO;
}

//UIScrollViewDelegate Protocol Reference. Called when the scroll view has ended decelerating the scrolling movement
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
    NSLog(@"DID END SCROLLING");
        pageControlBeingUsed = NO;
}

//Called when the page control value changes
- (IBAction)MoreTabChangePage {

        // Update the scroll view to the appropriate page
        CGRect frame;
        frame.origin.x = self.MoreTabScrollView.frame.size.width * self.MoreTabPageControl.currentPage;
        frame.origin.y = 0;
        frame.size = self.MoreTabScrollView.frame.size;
        [self.MoreTabScrollView scrollRectToVisible:frame animated:YES];

    self.MoreTabTitle.text = [titles objectAtIndex:self.MoreTabPageControl.currentPage];

        // Keep track of when scrolls happen in response to the page control
        // value changing. If we don't do this, a noticeable "flashing" occurs
        // as the the scroll delegate will temporarily switch back the page
        // number.
        pageControlBeingUsed=YES;
}

//Create a frame for each page and add the page to the scroll view
-(void)setUpPageViews{

    //Set up all page views for the more tab
    for (int i = 0; i < MoreTabPages.count; i++) {

        //Get the current table view controller page
        UIWebView *webController= [MoreTabPages objectAtIndex:i];

        //Request the URL and load the request
        NSURL *urll =[NSURL URLWithString:[websites objectAtIndex:i]];

        //Run requests in seperate thread
        dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);

        dispatch_async(queue, ^{

            NSURLRequest *firstReq = [NSURLRequest requestWithURL:urll];
            [webController loadRequest:firstReq];

            dispatch_sync(dispatch_get_main_queue(), ^{
                //Create a frame for the current table view controller
                CGRect frame = webController.frame;
                frame.origin.x = self.MoreTabScrollView.frame.size.width * i;
                frame.origin.y = 0;
                frame.size = self.MoreTabScrollView.frame.size;
                webController.frame = frame;

                //Add the the current table view controller page to the scroll view
                [self.MoreTabScrollView addSubview:webController];

                //Release the controller object it is no longer needed
                [webController release];

                if(i == 3){
                    [spinner stopAnimating];
                }
            });

        });

    }
}

//Set al the properties for the scroll view and page controll
-(void)setScrollandPageViewProperties{
    self.MoreTabScrollView.contentSize = CGSizeMake(self.MoreTabScrollView.frame.size.width * MoreTabPages.count,
                                                    self.MoreTabScrollView.frame.size.height);
    self.MoreTabScrollView.scrollsToTop = NO;
    self.MoreTabScrollView.contentOffset = CGPointMake(self.MoreTabScrollView.frame.size.width, 0);
        self.MoreTabPageControl.numberOfPages = MoreTabPages.count;
}

-(void)setupSpinner{
    spinner.hidesWhenStopped = YES;
    [spinner startAnimating];
}

//Called if the application receives a memory warning
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

//Called when the UIViewController's reference count goes to zero
- (void)dealloc {
    [super dealloc];
    [MoreTabPageControl release];
    [MoreTabScrollView release];
    [MoreTabTitle release];
    [MoreTabPages release];
    [titles release];
    [websites release];
    [spinner release];
}
@end
4

2 に答える 2

1

各 Web ビューの最小ズーム スケールを設定してみてください。

[self.aboutWebView.scrollView setMinimumZoomScale:0.1]

ゼロズームでスクロールビューがゼロに達すると、同じエラーがスローされます。

于 2013-07-15T16:44:18.490 に答える
0

これは、メソッドまたはプロパティを使用してインスタンスを 0 にスケーリングしているときにアフィン変換で発生する可能性があるため、スクロール ビューを確認してください。UIScrollViewsetZoomScale:animated:zoomScale

zoomScaleを確認し、少なくとも 0.1 に設定してminimumZoomScaleください。maximumZoomScale

関連している:

于 2016-07-21T10:55:01.227 に答える