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

Jus*_*tin 0 iphone objective-c

我知道之前曾问过这种问题,但我不能为我的生活找到它.我需要创建一个弹出窗口(蓝色窗口之一,就像在应用程序商店中输入密码一样).所以,我有三个简单的(希望)问题.

  • 什么是弹出窗口?

  • 如何只使用可滚动文本和按钮制作一个?

  • 我如何弄清楚按钮按下的时间,并用它做一些事情?

注意:我只问三个问题,因为我认为他们可以很容易地回答.事实上,我认为第一个问题可以在用于显示弹出窗口的代码中得到解答.第三个问题需要回答才能使用此功能.

此外,这不是一个"告诉我teh codez"的问题.我只想指出讨论这些问题的文档,尽管直接答案非常有用.

sha*_*irv 8

What is the popup window called?
Run Code Online (Sandbox Code Playgroud)

UIAlertView中

如何只使用可滚动文本和按钮制作一个?

    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];
Run Code Online (Sandbox Code Playgroud)

我如何弄清楚按钮按下的时间,并用它做一些事情?

正如UIAlertViewDelegate之前所述