Reputation: 119
Seeing as the blue doesn't go with my UI interface, im just wondering if there is a way to change the colour of the uialertview, or use a image instead. With all the buttons, 'dismiss' etc still there
Thanks
Upvotes: 9
Views: 12724
Reputation: 667
If looking for custom alert view then it might help.
https://github.com/Pradeepkn/PKCustomAlertView/
Hope it helps some one.
No need of setting delegate. You will get call back once the action completes on same method. Enjoy :)
Upvotes: 0
Reputation: 106
Subclassing UIAlertView is not an option, this class is not intended to be subclassed and doing so might be a reason of app rejection.
Instead, you might try to go through all alert view's subviews or create your own class
In case you are going to create your own class, here's an example of how to fake UIAlertView:
http://iosdevtricks.blogspot.com/2013/04/creating-custom-alert-view-for-iphone.html
Upvotes: 0
Reputation: 29524
The fine folks at CodeCropper just put out an open-source control that lets you create custom alert views. It's awesome.
https://github.com/gpambrozio/BlockAlertsAnd-ActionSheets
Upvotes: 20
Reputation: 1965
you can use a uiview instead of uialertview and can easily customize uiview according to your needs
Upvotes: 0
Reputation: 18488
You can either go through its subviews and change what you need to change, or subclass it. Because UIAlertView inherits from UIView you can use:
myAlertView.subViews
and modify the views or subclass UIAlertView to create your custom AlertView. Here is a very good article on how to sublass UIAlertView to get whatever design/color you want.
Basically what you want to override is this method:
- (void) drawRect:(CGRect)rect
Hope that helps.
Upvotes: 0
Reputation: 4399
You could try presenting a Modal View Controller with a transparent background.
ModalViewController *popupController = [[ModalViewController alloc] initWithNibName:@"ModalViewController" bundle:nil];
[self presentModalViewController:popupController animated:NO];
Something like this for the ModalView (http://stackoverflow.com/questions/849458/transparent-modal-view-on-navigation-controller)
This way you can create a custom Alert, but it's really a modal view that you can customize
Upvotes: 1