2010-10-05 34 views

回答

1

您可以通过按下Shift + Command + R来显示控制台窗口。您可以通过按Control + Option + Command + R来清除控制台窗口。这两个选项都可从Run菜单中获得。

+0

谢谢你的帮助在这里,但是这一次我没有帮助编程。 – eGanges 2016-04-15 19:36:30

3

这对我的作品 - 离开了最后激活的一部分,如果你想Xcode的留在你的应用程序的顶部:

bool ClearXCodeDebuggerConsole() 
{ 
    NSString *const scriptText = @"\ 
tell application \"System Events\"\n\ 
set currentapp to the name of the current application\n\ 
end tell\n\ 
tell application \"Xcode\" to activate\n\ 
tell application \"System Events\"\n\ 
keystroke \"r\" using {command down, control down, option down}\n\ 
end tell\n\ 
tell application currentapp to activate\n\ 
return true"; 

    NSAppleScript *script = [[[NSAppleScript alloc] initWithSource:scriptText] autorelease]; 
    [scriptText release]; 
    NSDictionary *dictError = nil; 
    NSAppleEventDescriptor *result = [script executeAndReturnError:&dictError]; 

    if (!result) return false; 
    if ([result booleanValue] != YES) return false; 
    return true; 
} 
+0

准确AppKit(OS X),但不幸的是iOS UIKit不是这样。具体来说,从AppKit文档@import Foundation派生的iOS库#import 不支持NSAppleScript和NSAppleEventDescriptor。 https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSAppleScript_Class/ – eGanges 2016-04-15 19:51:23