Added configurable background color and support for Interface Orientations #36

Closed
wants to merge 6 commits into
from

Conversation

Projects
None yet
6 participants

Allow the background white color and transparency to be set via BlockUI.h

Tod Cunningham added some commits Nov 26, 2012

I also added support for different interface orientations. While I don't try and handle landscape on the iPhone, I did need to handle landscape on an iPad. This change allows an optional interface orientation to be passed into the alert. For example:

This can be used if you are creating an alert from a UIViewController

BlockAlertView *alert = [BlockAlertView alertWithTitle:@"Match Ended"
                                               message:@"All players left this match before it started."
                             usingInterfaceOrientation:self.interfaceOrientation];

It is also possible to change the orientation on the fly by using the view controller's willRotateToInterfaceOrientation

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    [[BlockBackground sharedInstance] applyInterfaceOrientation:toInterfaceOrientation];
}
Contributor

bchessin commented Dec 9, 2012

+1. Thank you Tod. This pull fixed an issue which I was having where multiple alert's would show quickly and then wouldn't be dismissed. Thanks! :)

Contributor

bchessin commented Dec 9, 2012

The only other complaint I have is that whenever the alert is animating while a notification shows up, the position kind of gets messed up for an unknown reason but it still shows properly and dismisses properly. Not sure if you know what I mean, but you will notice it right away when it happens.

tcunning commented Dec 9, 2012

I haven't seen that one yet.

Contributor

bchessin commented Dec 9, 2012

The best way to reproduce it is to have someone else spam text your phone while you keep clicking a button showing a BlockAlertView and just keep doing it and you'll see the problem. :)

I am having some issues with orientations.

The Alert is rotating but it seems it's frame is not updating correctly.

Screenshot 09:12:2012 18:53.png
Screenshot 09:12:2012 18:53.png

tcunning commented Dec 9, 2012

Does this only happen after an orientation change? In your view controller are you doing the following?

  • (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
    {
    [[BlockBackground sharedInstance] applyInterfaceOrientation:toInterfaceOrientation];
    }
  • Tod

On Dec 9, 2012, at 1:54 PM, bencallis notifications@github.com wrote:

I am having some issues with orientations.

The Alert is rotating but it seems it's frame is not updating correctly.


Reply to this email directly or view it on GitHub.

Yeah, this only happens after an orientation change. I also call the applyInterfaceIrientation method in the willRotateToInterfaceOrientation.

Thanks,
Ben

Any ideas?

tcunning commented Jan 3, 2013

Thanks for the poke. I have a fixed checked in for this issue. It now uses an autoresize mask such that it will keep the alert centered in the view. Give it a try and let me know if that fixes it for you.

siuying commented Jan 3, 2013

When my iPad is in landscape mode and i launched a dialog, the dialog is in wrong orientation. Add following line:

    [self applyInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]];

in the end of [BlockBackground addToMainWindow:] fixes the issue.

will you also consider adding animation to the rotation?

EDIT:

Sorry, just missed the constructor BlockAlertView initWithTitle:message:usingInterfaceOrientation:!

tcunning commented Jan 3, 2013

When you launch the block alert are you using the following alertWithTitle:message:usingInterfaceOrientation: to open the alert? Here is an example:
BlockAlertView *alert = [BlockAlertView alertWithTitle:@"Match Ended"
message:@"All players left this match before it started."
usingInterfaceOrientation:self.interfaceOrientation];
The passed in orientation should position it correctly.

  • Tod

On Jan 3, 2013, at 12:23 AM, Francis Chong notifications@github.com wrote:

When my iPad is in landscape mode and i launched a dialog, the dialog is in wrong orientation. Add following line:

[self applyInterfaceOrientation:[[UIApplication sharedApplication] statusBarOrientation]];

in the end of [BlockBackground addToMainWindow:] fixes the issue.

will you also consider adding animation to the rotation?


Reply to this email directly or view it on GitHub.

Working perfect! Thanks very much.

Is there any chance that you could add orientation support to the TextPromptAlertView also?

Collaborator

barrettj commented Apr 30, 2013

This pull request can no longer be auto-merged so I'm closing it to get a fresh start. Feel free to rebase and submit a new pull request.

@barrettj barrettj closed this Apr 30, 2013

Is there a way to customize each button like background color or displaying as selected mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment