GithubHelp home page GithubHelp logo

jianfenggao / agwindowview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hfossli/agwindowview

0.0 2.0 0.0 570 KB

Add as many UIView's to UIWindow as you want. Specify the orientation or just follow the status bar.

License: Other

Ruby 1.64% Objective-C 98.36%

agwindowview's Introduction

AGWindowView

Add as many UIView's to UIWindow as you want. Specify the orientation or just follow the status bar. Status bar height is taken into account and you don't have to worry about a thing.

We're using it in Agens for custom alerts, but it can be used for anything. Should not be used as the first view on window.

The AGWindowView is filling the entire screen while your subviews may fill parts of the AGWindowView.

iOS 5 ~ iOS 8 and SDK's

AGWindowView is compatible with modern combinations of build SDK's and iOS system versions (iOS 5 ~ iOS 8). Make sure you use the latest tag/version.

Usage

It can be used in a number of different situations.

  • display something fullscreen
  • your app is in portrait and you want to play video in fullscreen landscape
  • show custom modals in specific orientations
  • display custom alerts on top of UI
  • should not be used as the first view on window.

Code examples

Support the current orientation the status bar might have

AGWindowView *windowView = [[AGWindowView alloc] initAndAddToKeyWindow];
windowView.supportedInterfaceOrientations = AGInterfaceOrientationMaskAll;
[windowView addSubview:view];

Slide up say a video player in landscape even though your app is in portrait

AGWindowView *windowView = [[AGWindowView alloc] initAndAddToKeyWindow];
windowView.supportedInterfaceOrientations = AGInterfaceOrientationMaskLandscapeLeft;
[windowView addSubviewAndFillBounds:player.view withSlideUpAnimationOnDone:nil];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];

Note: this won't actually rotate the statusbar, just the AGWindow.

Debug - Notes

Please note that we are using AGInterfaceOrientationMask and not UIInterfaceOrientation for the property supportedInterfaceOrientations.

I highly encourage either to set supportedInterfaceOrientations = AGInterfaceOrientationMaskAll or only use one of the orientations e.g. supportedInterfaceOrientations = AGInterfaceOrientationMaskPortrait. Mixing will be supported, but currently undergoes unexpected results.

Cocoa pods

It is added to the public cocoa pods spec repository under the name AGWindowView.

Agens | Digital craftsmanship

agwindowview's People

Contributors

hfossli avatar choefele avatar langtind avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.