Giter Site home page Giter Site logo

ios-custom-alertview's People

Contributors

dingosky avatar logicxd avatar oscarfung avatar scorpiozj avatar solacode avatar wimagguc 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

ios-custom-alertview's Issues

Misalignment when parentView is of type UITableView

If you scroll down a page in table view and then select a cell that displays CustomIOS7AlertView, the view is located at the top of the table. Need to add following code to CustomIOS7AlertView show method.

if ([parentView isKindOfClass:[UITableView class]]) {

    UITableView *tableView = (UITableView *)parentView;

    self.frame = CGRectMake(tableView.contentOffset.x, tableView.contentOffset.y, tableView.bounds.size.width, tableView.bounds.size.height);
}

I placed code immediately after [parentView addSubview:self];

Not auto rotate.

what about auto rotate based the orientation of the device.???

iOS6 support

Having intuition that this would become the best alternative to add a subview in alert view and use in iOS7 too. I'm reaching here, when I really need to change my code which need to have a custom alert view for iOS7 too. It's well implemented for iOS7. But it also looks same UI for lesser versions that's iOS 6. You should detect current iOS version and based on that provide UI for previous look and new UI look.

Keyboard not appear

I'm adding a uitextview into a view, and add this view in ios7alertview content, and the keyboard does not appear.
I'm doing something wrong, or there is a bug?

Code:

    int width = self.view.frame.size.width - 30;
    CustomIOS7AlertView *alertView = [[CustomIOS7AlertView alloc] initWithFrame:CGRectMake(0, 0, width, 130)];

    UIView *mainView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, 130)];

    UITextField *title = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, width, 30)];
    [title setTextAlignment:NSTextAlignmentCenter];
    [title setFont:[UIFont boldSystemFontOfSize:15]];
    [title setText:@"Reprove"];

    UITextField *message = [[UITextField alloc] initWithFrame:CGRectMake(0, 30, width, 30)];
    [message setTextAlignment:NSTextAlignmentCenter];
    [message setText:@"Message"];

    UITextView *textView = [[UITextView alloc]initWithFrame:CGRectMake(10, 60, width - 20, 60)];
    [textView.layer setCornerRadius:7];

    [alertView setContainerView:mainView];
    [mainView addSubview:title];
    [mainView addSubview:message];
    [mainView addSubview:textView];

    [alertView setUseMotionEffects:YES];

    [alertView setButtonTitles:[NSMutableArray arrayWithObjects:@"Cancel", @"Reprove", nil]];
    [alertView show];
    [textView becomeFirstResponder];

I'm using xCode 6.1.1 and iOS 8.1

ios simulator screen shot dec 7 2014 19 59 04
(In this image, the textview are focused)

Thanks

iOS8 Alertview Rotation Issue

landscape ipad
portrait ipad

Hello,

I am still facing rotation issue in iPad 2.0 with iOS 8.0. I m sure iPad mini will have still the same issue

See the images..Issues is in Landscape orientations.. AlertView's background is not getting resized and hence Alert is not displayed in the centre.

If I open an alert in Portrait mode, and change device's orientation to Landscape, at that time there is some problem in resizing the screenSize. And due to this , Alert is not displayed in the center of the screen

Have to modify the orientationDidChange code as it is only working currently with OS 7.1 or lower version. Transformation is not handled properly

Alert view doesn't appear

When I change the rootViewController in AppDelegate after first App lunch, the Alertview doesn't appear at all. whereas it's working before changing the rootViewController.

Thanks in Advance.

Creating with only init causes problems with keyboard.

Add a text field to an uiview.
Set textfield as first responder.
Set above uiview with setContainerView.
Call show on custom alertview.

Sometimes custom alertview is shown above the keyboard which renders the keyboard unresponsive to touch events.

Crash when adding multiple buttons

Hi there,

everytime when I try to use multiple buttons I got a crash. The view is shown, I see the buttons and then the app crashes with a EXEC_BAD_ACCESS

If I remove the "extra" Buttons everything is fine.
Am I missing something or is this a bug?

CustomIOS7AlertView *ALERT  = [[[CustomIOS7AlertView alloc] initWithParentView:self.view]autorelease];
[ALERT setButtonTitles:[NSMutableArray arrayWithObjects:@"Button1", @"Button2", @"Button3", nil]];

P.S. Thx for your work!
ptapp xcodeproj

Your code has problem with keyboard

First, Thank for your source code, with it, I can replace old alert version using add subview method and compatible with iOS 7.

But when I integrated it with UITextField , UITextView or something based on system.
In my case, I had a TextField in a landscape orientation. After editing textfield content, I show a your ALERT. But it displayed wrong.

Please see my photo.

Before Editing textfiled: https://dl.dropboxusercontent.com/u/31985459/problems/alert7.0a.png
After Editing testfield: https://dl.dropboxusercontent.com/u/31985459/problems/alert7.0b.png

And then, I fixed it like that:
Change from:
[[[[UIApplication sharedApplication] windows] lastObject] addSubview:self]; //line 108 or 109 your code.
to:
[[[[UIApplication sharedApplication] delegate] window] addSubview:self];

After all, Thank you.

Crash while closing CustomIOS7AlertView

Hi,

First of all, thank you for your great work !
I have an issue, I created a single view application (a Calculator app because i'm a beginner), and I use your project to show a UIAlert pop up message. It works fine unitl I press the "Close" button. I have a single view but I don't know why the close button make the app crash :/
I do the following in my CalculatorViewController.m :

  • (IBAction)diaplyInfo:(UIButton *)sender
    {
    CustomIOS7AlertView * Alertview = [[CustomIOS7AlertView alloc] init];
    [Alertview show];
    }

Thank you for your help !!
Sincerely,

S.B.

Table View

Hi guys, I wondering, how can I add uitableview in the Alert?

In my app I have an uitableview and if the user press in one row is going to show a dialog with a table (the table have some action).

May I made this behavior with your alertview?

Regards,

David

Wrong display if view is colorized

I've define a color for my custom view. The problem is that it's displayed outside the rounded corner of the alert. I tried to add an UIImage as subview but same problem.

screen shot 2014-01-29 at 4 09 07 pm

Identify what alert view was closed in more comfortable way

If I have a lot of alert views, I tag them to identify properly in controller delegate method. We need to create more comfortable way to do it (pass a tag in the delegate method, put some methods so users can tag buttons, etc?)

Here is how I do it now

Creating alert view(s)

-(void)makeAlert:(NSIndexPath*)indexPath {
    CustomIOS7AlertView *alertView = [[CustomIOS7AlertView alloc] initWithParentView:self.view];
    alertView.tag = 1;
    [alertView setDelegate:self];
    [alertView show];
}

Detecting that exactly the alert view above was closed

- (IBAction)customIOS7dialogButtonTouchUpInside:(id)sender
{
    NSLog(@"Button at position %d is clicked.", [sender tag]);
    NSLog(@"Alert View Tag: %d", [[[sender superview] superview] tag]);
}

The alert view not showing up at all

I have used the same code. Added the delegate and imported the header file. Still Alert not showing up

  • (IBAction)contactUs:(id)sender
    {
    // Here we need to pass a full frame
    CustomIOS7AlertView *alertView = [[CustomIOS7AlertView alloc] init];

    [alertView setContainerView:[self createDemoView]];
    [alertView setBackgroundColor:[UIColor blackColor]];

    [alertView setButtonTitles:[NSMutableArray arrayWithObjects:@"Close", nil]];
    [alertView setDelegate:self];

    [alertView setOnButtonTouchUpInside:^(CustomIOS7AlertView *alertView, int buttonIndex) {
    NSLog(@"Block: Button at position %d is clicked on alertView %d.", buttonIndex, [alertView tag]);
    [alertView close];
    }];

    //[alertView setUseMotionEffects:true];

    // And launch the dialog
    [alertView show];
    }

  • (void)customIOS7dialogButtonTouchUpInside: (CustomIOS7AlertView *)alertView clickedButtonAtIndex: (NSInteger)buttonIndex
    {

    [alertView close];
    }

  • (UIView *)createDemoView
    {
    UIView *demoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 290, 400)];

    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 300, 150)];
    label.backgroundColor = [UIColor clearColor];
    label.font = [UIFont fontWithName:@"helveticaNeue-Bold" size:13];
    label.textColor = [UIColor grayColor];
    label.numberOfLines = 12;
    label.lineBreakMode = NSLineBreakByWordWrapping;
    label.text = [NSString stringWithFormat:@"ssdmfbs shbf ,jsdhf b,shf b,shdfb ,sdfb ,sdfb ,sdjfb ,sdjfb,djksfbdjksf.skjdf.ksjdfh.ksjfdh.skjdfh.skjdfh.skjdfh"];
    [demoView addSubview:label];

    return demoView;
    }

CustomIOS7AlertView Bad_Access crash when setting the buttons

Hi,
I seem to be getting a Bad_Access crash whenever I set the buttons of the Custom AlertView. I noticed in another bug reported (#32) it was asked if the project was an arc based one.

However my project is not an arc based one, and I cannot change it because I'm using it as part of an iOS plugin for Unity3D which generates and uses non arc supported code.

Project doesn't build with Xcode 6.1

The included project CustomIOS7AlertView.xcodeproj doesn't build as is with Xcode 6.1. The error is error: could not read data from 'ios-custom-alertview/CustomIOS7AlertView/CustomIOS7AlertViewTests/CustomIOS7AlertViewTests-Info.plist': The file “CustomIOS7AlertViewTests-Info.plist” couldn’t be opened because there is no such file. With 6.x Xcode will build the unit test target even if it is not the current target. The quickest solution to this is just removing the unit test target, since there are no unit tests.

podfile ?

Can't see this on cocoapods.org

Tried...
pod 'CustomIOSAlertView', '~> 0.9.2'

I get the following error?

[!] Unable to satisfy the following requirements:

  • CustomIOSAlertView (~> 0.9.2) required by Podfile
  • CustomIOSAlertView (~> 0.9.2) required by Podfile

Bad access when using [alert setButtonTitles:NULL];

I'm using a custom alertView to indicate the loading of a UIWebView but it crashes with a bad access message. Without the setButtonTitles line it works fine.

-(void)webViewDidStartLoad:(UIWebView *)webView
{
alert = [[CustomIOS7AlertView alloc]initWithParentView:self.view];
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0,10,240,100)];
[spinner startAnimating];
UIView *demoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 240, 100)];
UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(0, -30, 240, 100)];

[demoView addSubview:spinner];
[demoView addSubview:label];
[alert setContainerView:demoView];
[alert setButtonTitles:NULL];

[alert show];

}

UITableView shows wrong in iOS8

when I set a UITableView be a container view,
UITableView shows wrong in iOS8.

CustomIOS7AlertView.m
line:82 dialogView.layer.transform = CATransform3DMakeScale(1.3f, 1.3f, 1.0);

// i try to fix it ... but... it is still shows wrong :(
dialogView.layer.transform = CATransform3DMakeScale(1.2f, 1.78f, 1.0);

Support for cocoapods?

I'm trying to install it using cocoapods but can not find a specification for this library:

I leave my PODFILE:

platform: ios, '7.0'
pod "CustomIOS7AlertView", "~> 0.81"

thanks!

Useless property buttonView?

Hi, thanks for making this, it saved a bunch of work. However, while investigating if there was some way of changing the font on the cancel button, I found the buttonView property. It does not seem to be referenced anywhere, so i think it may be bit rot. Was there some intended purpose for this property?

Alertview scaled automatically between calls

I discovered another strange behavior (maybe linked to IOS8, never appeared before...).

In my projects, the alertview is not defined programmatically but with storyboards. I instantiate the view, store in my current controller after the first call and reuse it (and attach as content) in my alert view next time i need it.

For an unknown reason, the first time the alert view size is correct, but every following call will scale my view :-D
For example:
1st call: 300x160
2nd call: 500x300.5
3rd call: 833x535

I discover that the view change during the close method, when the "animateWithDuration" block is called. I suspect the CATransform3DConcat modify my view size.

This problem might comes from my project also because i use this library for a long time and never had any problem. I just posted this to know if someone else had the same issue.

To resolve this problem (temporary because i don't like the following solution), i just recall the "instantiateViewControllerWithIdentifier" method everytime i need the alertview content.

Regards

Analyzer warning in initWithParentView:

If you run the analyzer you get the following warning: Instance variable used while 'self' is not set to the result of '[(super or self) init...]'.

It can be addressed by changing the code to:

- (id)initWithParentView: (UIView *)_parentView
{
    self = [self init];
    if (_parentView) {
        self.frame = _parentView.frame;
        self.parentView = _parentView;
    }
    return self;
}

I understand that the method is going away, but for the time being it is best not the have the analyzer warning, especially for projects where such warnings will cause the build to fail.

Alertview Rotation issue from Landscape to Portrait while key board is open

There is one major bug in the code. While I am running an app in iPad Landscape mode , having a keyboard opened (Say I am editing in textfield) , now if Alert is popped-up ... And I am rotating my iPad from Landscape to portrait mode at that time alertView's position is changing . Its a strange behaviour. Please update.
ios simulator screen shot 06-jun-2014 4 37 33 pm

Crash On Application Launch

Hi,

I have integrated this in my existing project, it works fine while running app in iOS 7 but in iOS 6 crashes as soon as app launch with the following error.

dyld: Symbol not found: OBJC_CLASS$_UIInterpolatingMotionEffect

Thanks!

Orientation Support

I can't get this thing to display landscape mode. You tried to control it so much aesthetically that it became stupid difficult to have it show in landscape orientation.

Alertview doesn't appear

I saw that some people (like me) had in some project the alert view not displayed.
I discovered (in my case) that it was because the view is attached to a wrong window (don't ask my why but my project seems to have two, i suspect another library needs it).

Si if you replace in the CustomIOS7AlertView.m the line

    [[[[UIApplication sharedApplication] windows] firstObject] addSubview:self];

by this one:

    [[[[UIApplication sharedApplication] delegate] window] addSubview:self];

The problem disappear. The question is then: Why isn't it the default behavior? Why is it better to test the first object of the window array?

Orientation is very bad for iPad(iOS8)

I have tried the demo app in iPad mini. The background view doesn't change its frame on orientation change and also the alertview shows wrong orientation

alertview tag

Hello,
I am setting the demoView tag in createDemoView as below

[demoView setTag] = 1;

but customAlertView does not seem to receive it and the tag is always 0. Any thoughts please

Go away with no buttons specified

I needed a custom alert view - great. But I just wanted the user to be able to touch anywhere on the dialog for it to go away. The default behavior, no buttons, just sites there. How about something simple like, in addButtonsToView... (i.e., this works perfectly for my needs...) Thanks again!

if (buttonTitles==NULL) {
    UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [closeButton setFrame:CGRectMake(0, 0, container.bounds.size.width, container.bounds.size.height)];
    [closeButton addTarget:self action:@selector(customIOS7dialogButtonTouchUpInside:) forControlEvents:UIControlEventTouchUpInside];
    [container addSubview:closeButton];
    return;
}

UITextField resignfirstresponder ?

This isn't so much an issue with your code, but I'm adding a subview, which has a uitextfield in it.

However, I need to resign the keyboard if the user taps elsewhere on the view.

So I guess I need an event if the subview is tapped ? which doesn't dismiss the alertview and keep on processing other events like buttons.

Any suggestions, maybe I've overlooked a very simple solution?

Thanks in advance.

design flaw?

Why not contain the UIView in a UIViewController, and then implement willRotateToInterfaceOrientation?

Hello

I added this into my pod file. -> pod install.

When i run the app ->

ld: library not found for -lPods-CustomIOSAlertView

Alertview not showing with init

I have used exactly the same code given in the demo, just to test how this works, and the alert isn't showing. This is the code:

CustomIOS7AlertView *alertView = [[CustomIOS7AlertView alloc] init];

//It works only when using initwithparentview

// Add some custom content to the alert view
[alertView setContainerView:[self createDemoView]];

// Modify the parameters
[alertView setButtonTitles:[NSMutableArray arrayWithObjects:@"Close1", @"Close2", @"Close3", nil]];
[alertView setDelegate:self];

// You may use a Block, rather than a delegate.
[alertView setOnButtonTouchUpInside:^(CustomIOS7AlertView *alertView, int buttonIndex) {
    NSLog(@"Block: Button at position %d is clicked on alertView %d.", buttonIndex, [alertView tag]);
    [alertView close];
}];

[alertView setUseMotionEffects:true];

// And launch the dialog
[alertView show];

The init is not working, I have used the deprecated version, the one with initWithParentView, and it works just fine.

AlertView should be attached to the frontmost window, not a view

Hello,

In the current implementation the alertView is attached to a view which is not the expected behavior from an alert. This is a problem in those case when there is a visible keyboard on the screen . Check this screenshot:
https://www.dropbox.com/s/xufacehfgi1dbfq/Screenshot%202013-09-30%2015.19.17.png

The alertView should be attached to the front most window. Something like:
[[UIApplication sharedApplication].windows.lastObject addSubview:self]; This way the parentView is not needed anymore.

Cheers,
StaS

Grey overlay is not removed

  • (void)customIOS7dialogButtonTouchUpInside: (CustomIOS7AlertView *)alertView clickedButtonAtIndex: (NSInteger)buttonIndex
    {
    [alertView close];
    }

This closes the alertView, but not the grey overlay. Appeared on iOS 8.1

Status bar doesn't darken like UIAlertView

Hi,

There's a behavior I would like to be improved. When the alert is displayed, the status bar doesn't darken as it gets when it calls the UIAlertView.

Any ideas how to fix this?

Thanks!

code crash

-[__NSArrayI release]: message sent to deallocated instance 0x9b1fcb0

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.