Move UIAlertView litle bit down in landscape mode in ios 7 - ios

alert = [[UIAlertView alloc] initWithTitle:#"Enter Student Name" message:#"" delegate:self cancelButtonTitle:#"Cancel" otherButtonTitles:#"Save", #"Save and Add", nil];
alert.tag = 1;
alert.alertViewStyle=UIAlertViewStylePlainTextInput;
[alert show];
its been working beautifully in potrait mode but in landscape my UITextfield going out of screen.and now i want to move a alertView frame a little bit down so that it will be visible .

Unfortunately you can't change any thing in the UIAlertView design in iOS7, you should use it as is, you have three chices here:
Take off the cancel button (If i were you i would do this).
Use a custom UIAlertView from cocoacontrols.com and put the three buttons at the same line.
Use another control like popover or modal.

Related

UIAlertView is not positioned at the center of the screen

I have to fix some bugs in an old application and got a really weird one. All alert views are shown in the top left corner for some reason. App doesn't use storyboards, main window is loaded from xib. What can cause this?
UPDATE: Code to initialize alert view is pretty standard. I'm calling it inside one of the controllers of UITabBarController. Same bug occurs even if I leave app's main window empty and initialize alert view in application:didFinishLaunchingWithOptions:
UIAlertView *testAlert = [[UIAlertView alloc] initWithTitle:#"Title"
message:#"Message"
delegate:nil
cancelButtonTitle:#"OK"
otherButtonTitles:nil, nil];
[testAlert show];
I fixed this by simply replacing the [alert show] with the present [self presentViewController:alert animated:YES completion:nil];

UIAlertView animation lag when shown

I am experiencing an odd lag in the animation whenever I display a UIAlertView. The buttons and labels on the alert view are appearing noticeably before the background. It is happening everywhere in the application that I display an alert
The alert in the example above is shown from the action method of the clear button:
-(IBAction)clearButtonTapped:(id)sender {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Clear Outbox" message:#"This will delete everything from your Outbox." delegate:nil cancelButtonTitle:#"Cancel" otherButtonTitles:#"OK",nil];
[alert show];
}
Does anyone know why this is happening / what I can do to stop it?
Set "renders with edge antialiasing" to NO in the info.plist
try this
[yourAlert performSelectorOnMainThread:#selector(show) withObject:nil waitUntilDone:NO];

UIAlertView message doesn't display properly when keyboard is displayed

The UIAlertView message doesn't show properly when the text field in it is being edited (when the keyboard is being displayed). Here's how it looks like:
When the keyboard isn't there:
This is the code that creates the alert view:
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:#"Title"
message:#"Enter a name for your recipe"
delegate:self
cancelButtonTitle:#"Cancel"
otherButtonTitles:#"OK", nil];
[alertView setAlertViewStyle:UIAlertViewStylePlainTextInput];
[alertView show];
Is there a way to change the size of some components of the view so that it fits properly in the screen when the keyboard is displayed?
Edit: I just discovered that the alert view becomes scrollable when the keyboard appears. So if you scroll down, you can see the message. But I didn't notice that the first time the alert view popped up, and other users might not either. For now, I'm using what Visput suggested.
It is standard behavior for iOS. You could see the same layout in "Photos" application when create new Album in landscape mode.
I think the best way in this situation: place all text to message but title set to nil.
In your case:
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:nil
message:#"Title: Enter a name for your recipe"
delegate:self
cancelButtonTitle:#"Cancel"
otherButtonTitles:#"OK", nil];

UIActionSheet show black line while presenting on iOS 7

UIActionSheet' was displaying properly in my one of the application until iOS 7 release. But now when I open UIActionSheet in iOS 7, it shows black line` on top corner of action sheet. As you can see in below image
After spending ample amount of time to find its reason, Finally I found that if we display UIActionSheet title (set title property with some text) then those black line removed by iOS 7. like image
But As per requirement I don't want to display UIActionSheet title. So Is there any other approach to remove those black lines in corner? Or its an iOS 7 bug?
- (IBAction) showActionsheetWithoutTitle:(id)sender {
UIActionSheet *actionsheet = [[UIActionSheet alloc] initWithTitle:#"" delegate:self cancelButtonTitle:#"Cancel" destructiveButtonTitle:nil otherButtonTitles:#"Button1", #"Button2",#"Button3", nil];
[actionsheet showInView:self.view];}
Replace #"" with nil for initWithTitle, as it takes a small gap between the title and other buttons:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:#"Button1", #"Button2",#"Button3", nil];

How do you call this iOS 7 control?

I am looking to add to my iOS app a control that looks like this menu on the bottom:
Can anybody tell me what control that is? Does not look like Picker View.
That is a UIActionSheet. Official Documentation
It cannot be dragged in from the list of UI elements. It is presented programmatically very similar to a UIAlertView.
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:#"Title"
delegate:self cancelButtonTitle:#"Cancel Button"
destructiveButtonTitle:#"Destructive Button"
otherButtonTitles:#"Other Button 1", #"Other Button 2", nil];
[actionSheet show];

Resources