简体   繁体   English

如何在iPhone上制作弹出窗口?

[英]How to make a popup window on iphone?

I know this kind of question was asked before, but I cannot for the life of me find it. 我知道以前曾问过这种问题,但我一生都找不到。 I need to make a popup window (one of the blue ones, like in the app store for typing the password). 我需要创建一个弹出窗口(蓝色的窗口之一,例如在应用商店中输入密码)。 So, I have three simple (hopefully) questions. 因此,我有三个简单的(希望)问题。

  • What is the popup window called? 弹出窗口叫什么?

  • How do I make one with only scrollable text and a button? 如何仅使用可滚动文本和按钮制作一个?

  • How can I figure out when the button was pressed, and do something with it? 我如何弄清楚何时按下按钮,并对其进行处理?

NOTE: I am only asking three questions because I think they can be answered very easily. 注意:我只问三个问题,因为我认为它们很容易回答。 Infact, I think the first question can be answered just in the code used to make it show the popup window. 实际上,我认为第一个问题可以通过用于显示弹出窗口的代码来回答。 The third question needs to be answered just to use this feature. 仅使用此功能需要回答第三个问题。

Also, this is not a "show me teh codez" question. 另外,这也不是“向我展示编码解码器”的问题。 I only want to be pointed to the documentation that talks about these, although direct answers would be very useful. 我只想指出涉及这些内容的文档,尽管直接答案将非常有用。

What is the popup window called?

UIAlertView UIAlertView

How do I make one with only scrollable text and a button? 如何仅使用可滚动文本和按钮制作一个?

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Some Title" message:@"\n\n\n\n" delegate:self cancelButtonTitle:@"Close" otherButtonTitles:nil];

UITextView *someTextView = [[UITextView alloc] initWithFrame:CGRectMake(15, 35, 250, 100)];
someTextView.backgroundColor = [UIColor clearColor];
someTextView.textColor = [UIColor whiteColor];
someTextView.editable = NO;
someTextView.font = [UIFont systemFontOfSize:15];
someTextView.text = @"Enter Text Here";
[alert addSubview:someTextView];
[alert show];
[someTextView release];
[alert release];

How can I figure out when the button was pressed, and do something with it? 我如何弄清楚何时按下按钮,并对其进行处理?

As stated before UIAlertViewDelegate 如前所述UIAlertViewDelegate

What is the popup window called? 弹出窗口叫什么?

UIAlertView

How do I make one with only scrollable text and a button? 如何仅使用可滚动文本和按钮制作一个?

Scrolling text inside the alert view is not supported directly. 不直接支持在警报视图中滚动文本。 You can try to add a custom UITextView as a subview to the alert view to achieve that effect. 您可以尝试将自定义UITextView作为子视图添加到警报视图中,以实现该效果。

How can I figure out when the button was pressed, and do something with it? 我如何弄清楚何时按下按钮,并对其进行处理?

By implementing the appropriate delegate method of UIAlertViewDelegate . 通过实现适当的UIAlertViewDelegate委托方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM