uialertview glossy look and feel - ios

I have created a uialertview
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:#"Prohibited"
message:#"In-App Purchase is disabled, cannot make a purchase!"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:#"Ok", nil];
[alert show];
Which creates a dialog as below
But I need something like
How do I get this glossy look and feel ? Working in iOS 7.1, xocode 5.
My app uses UIWebView, UIViewController

It will look glossy as seen in that image on iOS 6 and lower OSs. iOS 7 is now flat.
Now if you wish to create your own UIAlertView by subclassing it. Theres a few tutorials that will teach you how to. but you'll need to create your own graphics and will cause a extra programming.
All your custom drawing will have to be inside the drawRect or overriding the various elements in the UIAlertView.
I would look at the way this github project does it's own customization to the UIAlertView
https://github.com/Sumi-Interactive/SIAlertView
For example:

The non glossy UI goes with IOS 7, I have an old app which has IOS 6 as the target version - it has the glossy alert views in an IOS 6 device (iPhone 3GS) but once running in an IOS 7 device it follows the new format., If it is really important you may want to simulate UIAlertviews using modal subviews .... [self presentViewController: mediaUI animated: YES completion:NULL]; or pop view controllers if coding for iPad.
Here is an old sample code : https://github.com/TomSwift/TSAlertView

Related

Is it safe to present UIAlertController (alert style) on iPad without popover?

In my app, I display a UIAlertController when the user taps on a button on the screen. I either use a UIAlertController or a UIAlertView, depending on the API availability (since my app supports both iOS 7 and 8).
I simply want to display an alert view to the user so I'm using the .Alert style for my UIAlertController.
When the user is on an iPad, is it safe to display the UIAlertController (Alert style) without configuring a popover?
I saw some tutorials online. From my understanding, if using a UIAlertController (Action Sheet style), I need to configure a popover or else the app will crash. I just want to know if it works the same way with an Alert style UIAlertController.
I did some test on my iPad and the app did not crash without the popover. But I want to make sure this is safe.
You never use a UIPopoverController with UIAlertView or UIAlertController (no matter its style).
iOS will internally use a popover on an iPad when the UIAlertController style is "action sheet" but you don't deal with that yourself.
So you have nothing to worry about. Use UIPopoverController as-is using the presentViewController:animated:completed: method no matter the device and you are fine.

How to test if UIAlertView is shown on iOS 8?

I'm writing Unit tests for my app and there seems to be a problem with getting shown UIAlertView.
On iOS 7, this used to work:
UIAlertView* alertView = [NSClassFromString(#"_UIAlertManager") performSelector:#selector(topMostAlert)]
but this doesn't work on iOS 8.
Is there a way visible UIAlertView can be retrieved on iOS 8?
UIAlertView and UIActionSheet is combined in a class called UIAlertController in ios8. Kindly check the Apple Document
From Apple Doc
A UIAlertController object displays an alert message to the user. This
class replaces the UIActionSheet and UIAlertView classes for
displaying alerts. After configuring the alert controller with the
actions and style you want, present it using the
presentViewController:animated:completion: method.
Maybe it because iOS 8 use UIAlertController instead of UIAlertView.
Apple Developers Library "UIAlertController"

Alert message not rotating in IOS8

I am building an iPhone app which shows an alert message when a particular button is tapped. Auto-rotaion is in ON state. When i rotate my phone the whole app view as well as the alert message rotates in iOS7 But, in iOS8 views are rotated except alert message`
UIAlertView does not work properly in iOS8 The, iOS8 uses a new UIAlertController The given linked worked for my case.
Reference Link
This is happening because the iOS not able to understand the multiple operation at a time .You can call the UIalertview with delay like .I have same issue with iOS8 this code is working fine for me.
[self performSelector:#selector(showAlert) withObject:nil afterDelay:0.5];
-(void)showAlert
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:#"Your alert Title." message:#"Your alert Message." delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles:nil, nil];
[alert show];
}

How to position a UIAlertView

I've tried using this
message = [[UIAlertView alloc] initWithTitle:#"Incorrect!"
message:wrongString
delegate:self
cancelButtonTitle:#"Try Again"
otherButtonTitles:nil];
if(adjustIncorrect) {
NSLog(#"Showing adjusted");
message.transform = CGAffineTransformMakeTranslation( 0.00, 300.00);
}
[message show];
It is printing out Showing Adjusted, so I know that's not the issue. But the alert isn't moving no matter what numbers I put in. I've seen a few posts saying with the newer versions of iOs this might not work, any ideas?
Unfortunately you can't do it: "The UIAlertView class is intended to be used as-is and does not support subclassing. The view hierarchy for this class is private and must not be modified.". You should not access any private properties in UIAlertView directly as well as you should not subclass UIAlertView - this is clearly stated by Apple and is likely to lead to a rejection of your App during revision when sent for publication to the Apple Store. The same applies to UIActionSheet.
Instead you should look into implementing your own alert view to be loaded modally when needed.

UIActionSheet cancelButtonTitle ipad

I'm using UIActionSheet to present a set of choices to the user. It works fine on iPhone and iPod Touch, but on the iPad the "cancel" option is always hidden. That is, the "dialog box" with the options appears, but the "cancel" button is missing.
Here's the code:
self.popupQuery = [[[UIActionSheet alloc] initWithTitle:title
delegate:self
cancelButtonTitle:cancelButtonTitle
destructiveButtonTitle:nil
otherButtonTitles:option0, option1, cancelButtonTitle, nil] autorelease];
The UIActionSheet docs state:
cancelButtonTitle:
The title of the cancel button. This button is added to the action sheet automatically and assigned an appropriate index, which is available from the cancelButtonIndex property. This button is displayed in black to indicate that it represents the cancel action. Specify nil if you do not want a cancel button or are presenting the action sheet on an iPad.
I'm not passing nil, so I'm not clear what's going on. Is this a bug?
It might depend on how you are presenting your UIActionSheet, but bear in mind that tapping outside the UIActionSheet is the cancel button on the iPad.
While there may be an alternative way to present the UIActionSheet, the default will leave you with out that cancel button.
EDIT:
According to another answer on a very similar question, you can make the cancel button appear on iOS 4.2 and prior by using the following code. Note that in iOS 4.2.1, this seems to have been changed and will no longer work.
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
or this:
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;

Resources