Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/102.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIAlertView消息不';显示键盘时不能正确显示_Ios_Cocoa Touch_Ios7_Keyboard_Uialertview - Fatal编程技术网

Ios UIAlertView消息不';显示键盘时不能正确显示

Ios UIAlertView消息不';显示键盘时不能正确显示,ios,cocoa-touch,ios7,keyboard,uialertview,Ios,Cocoa Touch,Ios7,Keyboard,Uialertview,编辑UIAlertView中的文本字段时(显示键盘时),消息无法正确显示。下面是它的样子: 当键盘不在时: 这是创建警报视图的代码: UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Enter a name for your reci

编辑
UIAlertView
中的文本字段时(显示键盘时),消息无法正确显示。下面是它的样子:

当键盘不在时:

这是创建警报视图的代码:

        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];
是否有方法更改视图中某些组件的大小,以便在显示键盘时使其与屏幕正确匹配


编辑:我刚刚发现,当键盘出现时,警报视图可以滚动。因此,如果向下滚动,您可以看到消息。但是我没有注意到第一次弹出警报视图,其他用户也可能没有。目前,我正在使用Visput建议的方法

这是iOS的标准行为。在横向模式下创建新相册时,您可以在“照片”应用程序中看到相同的布局。
我认为在这种情况下最好的方法是:将所有文本置于
消息中,但
标题设置为零。
就你而言:

UIAlertView *alertView = [[UIAlertView alloc]
                              initWithTitle:nil
                              message:@"Title: Enter a name for your recipe"
                              delegate:self
                              cancelButtonTitle:@"Cancel"
                              otherButtonTitles:@"OK", nil];

尝试[alertView设置自动ResizingMask:UIViewAutoResizingOne];我试过了,但还是一样。“另一个变体是在UIAlertView对象中手动布局子视图,但它可能会导致很多错误。”我想再强调一点。您不想这样做。我错了,在ios7中手动布局UIAlertView似乎是不可能的(在ios6中也是可能的)。这就是为什么您可以考虑使用AlertView的自定义实现。有关详细信息,请参阅此主题:。我还删除了我的答案中建议使用自定义布局的部分。这仍然是可能的,但正如您所发现的,这是一个主要的麻烦,有可能导致应用程序被拒绝,并且很容易出现问题。我强烈劝阻任何人走那条路。正如您所说,自定义警报视图实现要容易得多。