Question: I need to convert an Array List to Object[][], I have tried several different methods, and all seem to toss up an error or two.

My latest try is this:

```
Object[][] array = dataList.toArray(new Object[dataList.size()][]);

```

This throws the following error:

```none
java.lang.ArrayStoreException
    at java.lang.System.arraycopy(Native Method)
    at java.util.ArrayList.toArray(Unknown Source)

```

My array list is populated with classes I made, this is the class:

```
class dataClass {
    int x;
    int y;
    int z;
    String string1;
    String string2;
    Date date;
    int event;

    public dataClass(int x, int y, int z, String string1, String string2,
            Date date, int event) {
        this.x = x;
        this.y = y;
        this.z = z;
        this.string1 = string1;
        this.string2 = string2;
        this.date = date;
        this.event = event;
    }
}

```

This is how I initialize my array list:

```
public static List<dataClass> dataList = new ArrayList<dataClass>();

```

I then add my new dataClass via:

```
.add(new dataClass(...));

```

Any help would be great, thanks.

Answer: 
I faced this problem yesterday, where @entropid answer worked for iOS 9 and below, but for iOS 10 it didn't (since iOS 10 did actually hide the status bar, where on iOS 9 and below it was just the `UINavigationBar` that changed its frame without hiding the status bar and, thus, it overlapped that bar).

Also, subscribing to `MPMoviePlayerControllerDidExitFullScreen` notification didn't work either, sometimes it simply wasn't called (in my particular case, it was because it was a video from a `UIWebView`, which used a different class of player which looks similar to `MPMoviePlayerController`).

So I solved it using a solution like the one @StanislavPankevich suggested, but I subscribed to notifications when a `UIWindow` has become hidden (which can be in several cases, like when a video has finished, but also when a `UIActivityViewController` dismisses and other cases) instead of `viewWillLayoutSubviews`. For my particular case (a subclass of `UINavigationController`), methods like `viewDidAppear`, `viewWillAppear`, etc. simply weren't being called.

**viewDidLoad**

```
- (void)viewDidLoad {
    [super viewDidLoad];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(videoDidExitFullscreen:)
                                                 name:UIWindowDidBecomeHiddenNotification
                                               object:nil];

    // Some other logic...
}

```

**dealloc**

```
- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

```

And finally, **videoDidExitFullscreen**

```
- (void)videoDidExitFullscreen:(NSNotification *)notification {
    // You would want to check here if the window dismissed was actually a video one or not.

    [[UIApplication sharedApplication] setStatusBarHidden:NO
                                            withAnimation:UIStatusBarAnimationFade];

}

```

I used `UIStatusBarAnimationFade` because it looks a lot smoother than `UIStatusBarAnimationNone`, at least from a user perspective.
My answer on this question works great. [Here](https://stackoverflow.com/questions/25878439/ios-8-youtube-video-embed/35511903#35511903) It will play the video inside your WebView normally but if you tilt your phone it will play in Landscape! 

Also important to note is if you include youtube.com as the Base URL it will load much quicker.

Make a UIWebView in your storyboard and connect the @property to it, then reference below.

```
    CGFloat width = self.webView.frame.size.height;
    CGFloat height = self.webView.frame.size.width;
    NSString *youTubeVideoCode = @"dQw4w9WgXcQ";
    NSString *embedHTML = @"<iframe width=\"%f\" height=\"%f\" src=\"http://www.youtube.com/embed/%@\" frameborder=\"0\" style=\"margin:-8px;padding:0;\" allowfullscreen></iframe>";
    NSString *html = [NSString stringWithFormat:embedHTML, width, height, youTubeVideoCode];
    self.webView.scrollView.bounces = NO;
    [self.webView loadHTMLString:html baseURL:[NSURL URLWithString:@"http://www.youtube.com"]];

```