2010-10-05 38 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