Thứ Hai, 18 tháng 5, 2015

Back or forward a page of UIPageView

When I need back or forward a page of UIPageView's views, my app throws exception with message "Invalid parameter not satisfying: [views count] == 3"

After "google", I fix this exception with link:
http://stackoverflow.com/a/24749239
dispatch_async(dispatch_get_main_queue(), ^{
    [self.pageViewController setViewControllers:@[ [self.storyboard instantiateViewControllerWithIdentifier:_pageStoryBoardIDs[0]] ]
                                     direction:UIPageViewControllerNavigationDirectionReverse
                                     animated:YES completion:nil];
});

Because the solution in link is writen in Objective-C, then I use the sniptcode:
let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT
dispatch_async(dispatch_get_global_queue(priority, 0)) {
    // do some task
    dispatch_async(dispatch_get_main_queue()) {
        // update some UI
    }
}

In link: https://thatthinginswift.com/background-threads/
- Comments

0 nhận xét:

Đăng nhận xét