首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NSAlert in XCode 7

NSAlert in XCode 7
EN

Stack Overflow用户
提问于 2016-11-23 20:10:04
回答 1查看 60关注 0票数 0

我想更新10.8到10.11的代码。这是原始代码。

代码语言:javascript
复制
            NSAlert *alertSheet = [NSAlert alertWithMessageText:@"Message Text." defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"Informative text PJ%@-%@ with more text.", self.projectNumber,self.projectName];
        [alertSheet setAlertStyle:NSCriticalAlertStyle];
        [alertSheet beginSheetModalForWindow:self.window modalDelegate:nil didEndSelector:nil contextInfo:nil];

有些代码是不推荐的。这是我到目前为止所做的,但不起作用。

代码语言:javascript
复制
            NSAlert *alertSheet = [[NSAlert alloc]init];
        [alertSheet setMessageText:@"Message Text."];
        [alertSheet setInformativeText:@"Informative text PJ%@-%@ with more text.", self.projectNumber,self.projectName];
        [alertSheet beginSheetModalForWindow:self.windowPreferences completionHandler:nil];
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-11-23 20:21:31

informativeText不是可变的(从来没有)

代码语言:javascript
复制
[alertSheet setInformativeText:[NSString stringWithFormat:@"Informative text PJ%@-%@ with more text.",  self.projectNumber,self.projectName]];

您也可以使用点符号。

代码语言:javascript
复制
alertSheet.informativeText = [NSString stringWithFormat...
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40773329

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档