GithubHelp home page GithubHelp logo

Comments (5)

vicky1787 avatar vicky1787 commented on August 18, 2024

I have put this in LNNotificationBannerWindow but i know it will overwrite on the pods update for the fixes you may do to improvise this component.

-(UIInterfaceOrientationMask)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}

  • (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
    {
    return UIInterfaceOrientationPortrait;
    }

Can we have a handle outside to lock or access this.

from lnnotificationsui.

LeoNatan avatar LeoNatan commented on August 18, 2024

How do you lock your the orientation of your app? Have you set the correct orientation in the app plist?

Another option is to implement - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window in your app delegate, and provide the portrait orientation there.

I am not sure how to solve this. Each window allows its controller stack to determine the allowed orientation. So I could query the main window's allowed orientation, but this is incorrect, as there may be multiple windows alive, each with different supported orientations. Another option is to display notifications only in the orientation the interface was at the time of presentation. I don't like this because the experience suffers for all other applications where rotation is supported.

from lnnotificationsui.

vicky1787 avatar vicky1787 commented on August 18, 2024

Hello LeoNatan,

I have implemented the stack in every controller to past the code that will determine what orientation is supported in the view controller.

`

 -(BOOL)shouldAutorotate
 {
   return YES;
 }

- (UIInterfaceOrientationMask)supportedInterfaceOrientations{    //NSLog(@"supported called in red    1");
    return UIInterfaceOrientationMaskPortrait;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return toInterfaceOrientation == UIInterfaceOrientationPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

Also the customised navigation controller have this code.

 - (BOOL)shouldAutorotate {
    return [[self.viewControllers lastObject] shouldAutorotate]; 
}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return  [[self.viewControllers lastObject] supportedInterfaceOrientations]; 
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return [[self.viewControllers lastObject] shouldAutorotateToInterfaceOrientation:toInterfaceOrientation]; 
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
}

As i have some view controller that support both orientation so the above APPDelegate fix is not good. Please suggest me some solution over this.

from lnnotificationsui.

LeoNatan avatar LeoNatan commented on August 18, 2024

I just tested on my demo project.

If the project is defined correctly to only support portrait, notifications do not rotate. Define like so:

screen shot 2016-01-20 at 14 10 34

If your entire app is portrait, you should remove all your functions and just use that.

from lnnotificationsui.

vicky1787 avatar vicky1787 commented on August 18, 2024

No my few pic gallery full screen views are supporting both orientation hence I can't use the settings above as u mentioned

from lnnotificationsui.

Related Issues (20)

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.