iOS 应用界面优化与自动旋转功能实现
1. 模拟用户操作反馈
在实际应用中,当用户发起请求时,我们需要进行相应的处理。这里我们只是模拟处理,并通过警报通知用户。若用户在顶部文本框中输入了姓名,我们会获取该姓名并用于警报消息;若未输入,则显示通用消息。以下是实现代码:
NSString *msg = nil;
if (nameField.text.length > 0)
msg = [[NSString alloc] initWithFormat:
@"You can breathe easy, %@, everything went OK.",
nameField.text];
else
msg = @"You can breathe easy, everything went OK.";
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Something was done"
message:msg
delegate:nil
cancelButtonTitle:@"Phew!"
otherButtonTitles:nil];
[alert show];
// 内存清理等操作
警报视图和操作表的创建和使用方式类似。这里我们不关心用户何时关闭警报视图或
超级会员免费看
订阅专栏 解锁全文
670

被折叠的 条评论
为什么被折叠?



