Giter VIP home page Giter VIP logo

sialertview's Introduction

SIAlertView

An UIAlertView replacement with block syntax and fancy transition styles. As seen in Grid Diary.

Flattr this git repo

Preview

SIAlertView Screenshot

Features

  • use window to present
  • happy with rotation
  • block syntax
  • styled transitions
  • queue support
  • UIAppearance support

Installation

Cocoapods(Recommended)

  1. Add pod 'SIAlertView' to your Podfile.
  2. Run pod install

Manual

  1. Add all files under SIAlertView/SIAlertView to your project
  2. Add QuartzCore.framework to your project

Requirements

  • iOS 5.0 and greater
  • ARC

(If you are having any problems, just select your project -> Build Phases -> Compile Sources, double-click the SIAlertView and add -fobjc-arc)

Examples

Code:

SIAlertView *alertView = [[SIAlertView alloc] initWithTitle:@"SIAlertView" andMessage:@"Sumi Interactive"];

[alertView addButtonWithTitle:@"Button1"
                         type:SIAlertViewButtonTypeDefault
                      handler:^(SIAlertView *alert) {
                          NSLog(@"Button1 Clicked");
                      }];
[alertView addButtonWithTitle:@"Button2"
                         type:SIAlertViewButtonTypeDestructive
                      handler:^(SIAlertView *alert) {
                          NSLog(@"Button2 Clicked");
                      }];
[alertView addButtonWithTitle:@"Button3"
                         type:SIAlertViewButtonTypeCancel
                      handler:^(SIAlertView *alert) {
                          NSLog(@"Button3 Clicked");
                      }];

alertView.willShowHandler = ^(SIAlertView *alertView) {
    NSLog(@"%@, willShowHandler", alertView);
};
alertView.didShowHandler = ^(SIAlertView *alertView) {
    NSLog(@"%@, didShowHandler", alertView);
};
alertView.willDismissHandler = ^(SIAlertView *alertView) {
    NSLog(@"%@, willDismissHandler", alertView);
};
alertView.didDismissHandler = ^(SIAlertView *alertView) {
    NSLog(@"%@, didDismissHandler", alertView);
};

alertView.transitionStyle = SIAlertViewTransitionStyleBounce;

[alertView show];

Credits

SIAlertView was created by Sumi Interactive in the development of Grid Diary.

License

SIAlertView is available under the MIT license. See the LICENSE file for more info.

sialertview's People

Contributors

alexanderedge avatar bobreid avatar edwardmp avatar filipengberg avatar fr4ncis avatar iiiyu avatar kyoji2 avatar linjunpop avatar mfkp avatar mrcrow avatar peterwilli avatar plackemacher avatar ricsantos avatar tiagojsalmeida avatar yutmr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sialertview's Issues

If Two Alerts Are Displayed, The Bottom One Is Dismissed Automatically

I'm currently using this library to display achievements in a game. The problem is that if the user completes two achievements in a round, an alert view for achievement 2 (second alert view) is displayed but when I dismiss it the first alert view isn't there anymore. How can we fix this so that it isn't removed automatically.

Autorotates to all orientations even when view controller underneath doesn't

Especially problematic on iOS7 where a status bar rotates along the alert. To reproduce, change the example project like this:

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait; // from All
}

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

- (BOOL)shouldAutorotate
{
    return NO; // from YES;
}

Warning: Capturing 'self' strongly in this block is likely to lead to a retain cycle

I get this warning when I try to call one of my viewcontroller methods using [self alertButton1Method] from within the sialert instance button handler. This only happens when my sialert instance is declared as a global variable (which I need to dismiss the alert at a later point). Everything works fine, I've just never encountered this warning and I'm not sure what problems it can cause down the line. Is this normal behavior, or is there something am I doing wrong?

Sheet (Container) Color

Hi, thanks for this project!

It would be nice if the sheet (container) view's color [hardcoded to white] would be customizable via appeareance proxy as well.

Corner's Radius

The corners that are displayed on a real project are a bit difference than the ones that are displayed on Github's project description.

Add support for text fields in the alert

This plugin should be enhanced with the possibility to add a text field in the alert as the current UIAlertView already does:

prompt.alertViewStyle = UIAlertViewStylePlainTextInput;

Issue With sizeWithFont

Due to iOS7 there has been a deprecation with sizeWithFont: constrainedToSize: lineBreakMode and sizeWithFont: minWithFont: actualFontSize: forWidth: lineBreakMode:

Please fix! :)

Options for Two Button placement

Nice control. It would be really nice if two buttons didn't always force to side by side. An mode that displays them stacked (like it shows with 3 buttons) would be awesome.

Is this component still actively maintained?

Thank you for the great work done on this nice component. In consideration of the current state I would like to ask if this component is still actively maintained? It seems passive with the amount of open issues and pull-requests. What are the future plans for this repo and do you plan to continue with this component?
If your time is limited to still maintain this repo, I would suggest to add some collaborators to the project, which may help in the merging pull-requests, fix issues etc. in the future. What do you think?

Something like addTextFieldWithPlaceHolder

Helllo guys, great work!!!
Are you considering to add a new feature to add also a textField like the Button?
I think that would be a great add-on to the project.
Cheers.

Dynamic text support

Hi guys,

SIAlertView doesn't support dynamic text,as well as native UIAlertView.So I am curious is there any reason for this not to be done?
I think, that dynamic text support will be benefit from user perspective

SIAlertView window does not resign on iOS 8

The window for SIAlertView is staying around swallowing touches on iOS 8. Only reproducible on device in release mode.

Edit: Appears to happen on 8.0.2 but not 8.0

Anyone else seeing this?

-fobjc-arc

I get some errors and to fix that i needed to add the flag -fobjc-arc in the build phases -> compiled sources -> SIAlertView.

It is useful to users if they get same errors ( the error was from the singleton ).

Happy Coding!

An error

When I click at any button, the application crashes withs such error:
2015-01-19 14 24 39

I tried to add -fobjc-arc to build phase, but it didn't work... Help me!!!

Crash: index 0 beyond bounds for empty array

Crashlytics reports to me that quite often I get a crash with the following stack trace:

0 ...    CoreFoundation  __exceptionPreprocess + 130
2    CoreFoundation  -[__NSArrayM objectAtIndex:] + 232
3    Kokbokshyllan  
SIAlertView.m line 698
-[SIAlertView validateLayout]
4    Kokbokshyllan  
SIAlertView.m line 639
-[SIAlertView layoutSubviews]
5    UIKit   -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 346
6    QuartzCore  -[CALayer layoutSublayers] + 142
7    QuartzCore  CA::Layer::layout_if_needed(CA::Transaction*) + 350
8    QuartzCore  CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
9    QuartzCore  CA::Context::commit_transaction(CA::Transaction*) + 228
10   QuartzCore  CA::Transaction::commit() + 314
11   UIKit   -[UIApplication _sendOrderedOutContextsAndInvalidate:] + 114
12   UIKit   orderOutContextObserverCallout + 34
13 ...   CoreFoundation  __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
19   UIKit   UIApplicationMain + 1136
20   Kokbokshyllan  
main.m line 16
main
21   Kokbokshyllan   start

I can not reproduce the crash myself. Any idea on what might happen and how to reproduce? :)

Breaks scroll to top.

So in my view I have a copy url function which fires the alert view. Everything works as it should, but when I press ok and try to scroll to top by the status bar, it won't work. Before the alert, all is fine.

Here is how I call it.


SIAlertView *alertView = [[SIAlertView alloc] initWithTitle:@"URL successfully copied to the clipboard." andMessage:nil];
        [alertView addButtonWithTitle:@"OK"
                                 type:SIAlertViewButtonTypeCancel
                              handler:^(SIAlertView *alert) {

                                  NSLog(@"OK Clicked");
                              }];

        alertView.transitionStyle = SIAlertViewTransitionStyleDropDown;
        [alertView show];
        [alertView release];

in iOS 7 statusBar style changed.

In my application I use new UIStatusBarStyleLightContent, but when SIAlertView is showed it changed to default.
Possible you know how to fix it?

On dismiss frozen UI.

Hello !
SIAlertview works like charm but here is a tricky situation that always freezes my interface.

I got an alert showing (a SIAlertView latest release).

An async event (eg. push notif) comes out. This event is likely to show a modal view controller.
Everythings works fine, the alert is still in foreground and the modal view controller is background.

BUT when i click to dismiss the alert, the interface of my view controller behind do not respond anymore.

I think this bug is generated by the window it creates... but not sure...

Lacking assets

While installing via cocoapods I had to add images manually.

Buttons / UITextField

I was looking for a replacement for the uialertview with three buttons, ok, forgot and cancel, be nice to see a screenshot with more buttons and a uitextfield, maybe example code showing how to access the text value too.

Crash [SIAlertView transitionInCompletion:]_block_invoke

 libobjc.A.dylib    

objc_msgSend + 5
indexOfObject:
1
Eudic
SIAlertView.m line 357
__19-[SIAlertView show]_block_invoke
2
Eudic
SIAlertView.m line 456
__38-[SIAlertView transitionInCompletion:]_block_invoke248
3
UIKit
-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 284
4
UIKit
-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 178
5
UIKit
-[UIViewAnimationState animationDidStop:finished:] + 66
6
QuartzCore
CA::Layer::run_animation_callbacks(void*) + 234

Code :

  • (void)transitionInCompletion:(void(^)(void))completion
    ......
    if (completion) {
    (line 456 ) completion();
    }
    .....
  • (void)show
    .......
    (line 357) NSInteger index = [[SIAlertView sharedQueue] indexOfObject:self];
    .....

dyld_fatal_error

Hi, whenever I call [alertView show], my app crashes with dyld_fatal_error and dyld::fastBindLazySymbol(ImageLoader**, unsigned long)

Sorry for not providing much more information, I am new to Objective C

Thanks,

James

(XCode 4.6.3, OS X 10.7.5, iOS 5-6.1)

Usage enhancement

Maybe we can make the usage a bit more easier to use, eg:
[SIAlertView showMessage:withDismissButtonText:optionalTransitionType:action]

that would be much easier to use since the alerts are mostly used for make warnings.

Crashing when using in openURL method

Hi I am using SIAlertView in my AppDelegate when this is called:

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation

I am just using the basic integration and getting an EXC_BAD_ACCESS as the SIAlertView is shown. Any ideas as to what may be causing this?

Thanks for your help.

small question

I like this control a lot and i was wondering if there you either would like to add support for custom views, i could personalise completely the popup or if there is a similar control that allows to use similar transitions but with custom views?

Application freezes after dismissing a SIAlertView

The following code is used to create and show an alert view.

SIAlertView *av = [[SIAlertView alloc] initWithTitle:NSLocalizedString(@"SELECT_DISPLAY_NUMBER", nil) andMessage:nil];

[av addButtonWithTitle:myDisplayNumber type:SIAlertViewButtonTypeDefault handler:^(SIAlertView *alertView) {
            NSLog(@"update display number %@", myDisplayNumber);
            [self updateDisplayNumber:myDisplayNumber];
}];
[av show];

Then when clicking one of the buttons, even Cancel, the handler block executed and everything seems to be in order, except that the UI becomes non-responsive, and I have to kill the application.

Are there any obvious reasons for this, that I don't see or know about?
I'm using CocoaPods, and I'm compiling to and running on iOS 6.1 with XCode 4.6.3 on OSX 10.8.4.

Any tips on how to debug and resolve this issue would be greatly appreciated!

Flicker on dismiss

The semi-transparent background / containerView behind the alert view box flickers on/off rapidly when the alert is dismissed.

Have seen this behaviour on iOS7 & iOS8 Simulator & devices.

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.