[[UIApplication sharedApplication]setStatusBarHidden:YES withAnimation:NO];
// Create window
UIWindow *statusWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0,0,320,20)];
statusWindow.windowLevel = UIWindowLevelStatusBar;
statusWindow.backgroundColor=[UIColor redColor];
// Dont make the statusWindow keyWindow or the keyboard won't work!
// [statusWindow makeKeyAndVisible];
// Create statusBarButton
UIButton *statusBarButton = [UIButton buttonWithType:UIButtonTypeContactAdd];
statusBarButton.frame = CGRectMake(230, 2, 15, 15);
statusBarButton.backgroundColor=[UIColor redColor];
[statusBarButton addTarget:self action:@selector(goTop) forControlEvents:UIControlEventTouchUpInside];
// Place button into the new window
// Instead, add this:
[self.window makeKeyAndVisible]; // has to be main window of app
statusWindow.hidden = NO;
[statusWindow addSubview:statusBarButton];